11

Is it safe to use the HTTP status code 308 Permanent Redirect (suggestion) in server responses? The issue with 301 Moved Permanently is that it only works with GET requests (to be fair: POST will transform to GET which is NOT an option).

The status code is very newish in "RFC time" so what would you suggest?

What would a browser do if its not aware of 308? Would it find the location and do 302?

burnersk
  • 1,966
  • 4
  • 25
  • 38
  • Newer even than you seem to realize; [it's an RFC now](http://tools.ietf.org/html/rfc7238). – Michael Hampton Jul 03 '14 at 14:01
  • 1
    Did you read the [Deployment Considerations](http://tools.ietf.org/html/rfc7238#section-4) section? – Håkan Lindqvist Jul 03 '14 at 14:02
  • 308 is ***not*** a standard - it's a proposal, still in the experimental stage. Browers *should* fall back to a 300 interpretation of any 301-399 error that they don't specifically understand. – Chris S Jul 03 '14 at 14:03
  • meh. I totally overread Deployment Considerations section :( Thanks :) – burnersk Jul 03 '14 at 14:05
  • 1
    Under what scenario would you expect to receive a POST request sent directly to an outdated URL? – Skyhawk Jul 03 '14 at 14:25
  • 1
    @Skyhawk : I work with offline features “of“ html5. For comments or creating new posts the target url may have changed due to modification to the post itself out its categories. – burnersk Jul 08 '14 at 20:08
  • If you're still around, do you mind if I started a bounty on this question? It's been over a year and things should have changed by now. – muru Aug 18 '15 at 22:53
  • As at today, Bingbot does not support 308 redirects. googlebot does – Colin Dove Nov 01 '19 at 13:56

3 Answers3

7

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308

The RFC 7538 proposal have wide support today. It's safe.

308 instead 301. 307 instead 302.

move != redirect

Move reminds a specific address and/or file moved. Redirect is a new location or address.

perroud
  • 71
  • 1
  • 1
4

Although 308 is now a standard (https://www.rfc-editor.org/rfc/rfc7538), it is not currently Safe [Edit] (as of 3 April 2019), especially for desktop applications, but may be almost safe in some specific regions (e.g. India), or for applications targeted at tablets and mobile devices.

The lack of safety is because IE 11 on Windows 7 and 8.1 does not support it. In IE 11 the site just appears to hang. Luckily the IE that shipped with Windows 10 does support it, so it will be just a case of waiting until the general populous moves on from Windows 7 (Win 7 has only just been surpassed by Win 10 in global usage stats, Win 8 is significantly less popular than both) [Edit] or your company makes a decision to no longer support it (which you can make a very strong case for from 14th January 2020 when Windows 7 loses even long term support), and even more so from 15th June 2022 when IE itself will no longer be supported (see the download page for it).

All other modern browsers support it (Chrome, Firefox, Safari, Edge, Opera).

[Edit] Usage stats from March 2019 to help make your decision:

  • 36.52% of desktop users are still on Windows 7
  • 9.83% of desktop users were on IE; as Win10 pushed Edge so much, I'd assume most of these users to be on Win 7.

[Edit] Usage stats from March 2022:

  • 24.79% of desktop users are still on Windows 7
  • 4.84% of desktop users were on IE; as Win10 pushed Edge so much, I'd assume most of these users to be on Win 7. Ref netmarketshare

So, a decision to use 308 would affect less than 5% of desktop users as of this edit (2022-03-11). If your application is geared more towards tablets/mobile devices, this value will be significantly lower. Similarly if your app is specifically for the Indian market.

You can test if your browser supports 308 redirects here: https://webdbg.com/test/308/

monty
  • 156
  • 5
3

To end this: No it is not safe to use that status code. See comments for details.

308 is not a standard - it's a proposal, still in the experimental stage. Browers should fall back to a 300 interpretation of any 301-399 error that they don't specifically understand.

Some browsers just fail completely on that status code.

burnersk
  • 1,966
  • 4
  • 25
  • 38
  • 1
    This answer is out of date. I believe the RFC has been and accepted available for use across modern browsers https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308 . However, if you require support from older browsers, this may still be an issue! – Yahya Uddin Mar 09 '17 at 17:13
  • 3
    It does not work in IE11 on Win8.1 and lower (it works on Win10). – Bart Verkoeijen Aug 08 '17 at 08:24
  • https://tools.ietf.org/html/rfc7538 " The Hypertext Transfer Protocol Status Code 308 (Permanent Redirect)" published in April 2015. – Patrick Mevzek Jun 19 '19 at 16:50