大网数据广告活动
服务器运维问答

Is it safe to use HTTP status 308 Permanent Redirect?

· 52CE 我爱测

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 a…

问题原文

原帖链接 · burnersk · CC BY-SA 3.0

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?

已采纳解答

原帖链接 · monty · CC BY-SA 4.0

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/

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-07-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。