这种场景是怎样的?
https://www.rfc-editor.org/rfc/rfc9110#status.302
上面是规范内容,估计你使用的是302响应状态码。里面写了这一句
Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the 307 (Temporary Redirect) status code can be used instead.
8 回答2.4k 阅读
2 回答5k 阅读✓ 已解决
5 回答754 阅读
4 回答998 阅读✓ 已解决
4 回答1.1k 阅读✓ 已解决
3 回答2.1k 阅读
1 回答2.5k 阅读✓ 已解决
大多数情况下使用的 301/302 重定向,在重定向的时候,都会变为 GET 请求,如果想要保持之前的请求方式,可以改为 307 重定向。
使用 HTTP 强制跳转 HTTPS 不是一个好的做法,好的做法是使用 HSTS,来引导浏览器使用 HTTPS 访问。因为你一开始的 HTTP 请求就不是安全的。