当服务器以 301 或 302 响应时,所有 HTTP 客户端都会重定向 GET 请求吗?

Will all HTTP clients redirect GET requests when a server responds with a 301 or 302?

我已经通读了 HTTP 1.0 和 HTTP 1.1 规范的一些相关部分,试图确定是否所有 HTTP 客户端在收到对 GET 请求的 301 或 302 响应时都会执行适当的重定向。

在这种情况下,是否有任何 HTTP 客户端不会自动遵循返回的重定向?

你为什么想知道这个?如果是这样,您打算如何处理答案,而不是使用重定向?

规格非常清楚地说明:

6.4. Redirection 3xx

The 3xx (Redirection) class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. If a Location header field (Section 7.1.2) is provided, the user agent MAY automatically redirect its request to the URI referenced by the Location field value, even if the specific status code is not understood.

所以不,不自动重定向的客户端仍然符合规范。