302 Moved Temporarily和302 Found有什么区别?

16次阅读

同样是302跳转,我看有时候是302 Moved Temporarily,有时候是302 Found,这两个有啥区别呢?

blankyao

二者在不同HTTP协议下的状态信息不同。

在HTTP/1.0 302 状态为 Moved Temporarily

The requested resource resides temporarily under a different URL. Since the redirection may be altered on occasion, the client should continue to use the Request-URI for future requests.

在HTTP/1.1 302 状态为 Found

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.

参考链接
HTTP/1.1 -> http://www.w3.org/Protocols/rfc2616/r…
HTTP/1.0 -> http://www.w3.org/Protocols/HTTP/1.0/…

xhinking

按照http1.1的标准,302状态只能是Found,没有Moved Temporarily,所以Move Temporarily估计只是一个不标准的描述而已
虽然status code后面的描述是可以自定义,但是既然使用了http协议,还是应该按照他的标准来做

http status code以及描述可见w3c文档:http://www.w3.org/Protocols/rfc2616/r…

Chris_Yue

我来抛一个问题:
如用weblogic或者tomcat部署仅有一个应用如A,然后用curl命令发一个HTTP请求但是发送的时候修改了Host头
1 http://ip:port/A –> 返回302 Moved Temporarily
2 http://ip:port/A/ –> 返回正常,可能是A应用下的index.html
3 http://ip:port/B –> 返回404
自己对上面的现象比较疑惑,希望高手解答一下

ebo_1008

正文完