原因在上一篇提到Failed to load resource: the server responded with a status of 405 (Not Allowed)
少说话上代码:
```java
location /api/ {
proxy_pass http://172.0.0.1:8085;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
可以保证post请求变成get时,重定向到后台请求的参数不会丢失。
本文详细介绍了如何通过特定的Nginx代理配置,解决HTTP请求中出现的405错误(方法不允许)。通过示例代码展示了如何确保POST请求转换为GET时,重定向到后台的请求参数不会丢失。
3万+

被折叠的 条评论
为什么被折叠?



