302 重定向到相对 URL 是有效还是无效? [英] Is a 302 redirect to relative URL valid, or invalid?

查看:24
本文介绍了302 重定向到相对 URL 是有效还是无效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 RFC,302 的 HTTP 响应中的位置字段似乎应该是绝对的.https://www.rfc-editor.org/rfc/rfc2616#section-14.30

Based on the RFC it seems like the Location field in an HTTP response for a 302 should be absolute. https://www.rfc-editor.org/rfc/rfc2616#section-14.30

如果这个说法是正确的,浏览器是否尊重这一点 - 或者他们是否允许相对路径?

If this statement is correct, do browsers honor this - or do they allow relative paths?

推荐答案

相对 URL 有效.

RFC 2616 中存在错误.请参阅 http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p2-semantics-17.html#rfc.section.9.5.

There is a bug in RFC 2616. See http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p2-semantics-17.html#rfc.section.9.5.

这篇关于302 重定向到相对 URL 是有效还是无效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆