如何解释 IIS 网络日志中的 HTTP 状态代码 302

How to interpret HTTP Status Code 302 in an IIS web log

我正在查看我的 IIS 网络日志并注意到一些 sc-status 为 302 的日志记录。

我做了 research 并且只是更加困惑。

乍一看,它看起来很简单,如果有点模糊。

"This is an example of industry practice contradicting the standard. [...] Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between the two behaviours.[25] However, some Web applications and frameworks use the 302 status code as if it were the 303."

虽然我理解这个概念,但我不确定在查看 IIS 网络日志时应用哪个含义。我是将 302 状态代码视为 303("See Other" -- 一种重定向到新 URL 的方式)还是作为 307("Temporary Redirect")?

307 导致使用与请求原始 url 相同的 "verb" 进行重定向。这允许 POST 数据被保留。相比之下,301/302 将始终导致新 url 的 GET,丢失任何可能存在的 POST 数据。

同样,使用 301/302,浏览器可以缓存响应并始终转到新的 url,绕过原始 url。 307 要求再次命中原始 URL,即使最终确实是另一个重定向。