kas*_*sko 3 nginx http-status-code-405
我在 nginx 使用 Http POST 方法下载 excel 文件时遇到问题。事实上,我收到状态代码:405 不允许。
这是我的配置
upstream backend{
server localhost:9090;
server localhost:9091;
server localhost:9092;
server localhost:9093;
}
server {
listen 8887;
server_name localhost;
location / {
proxy_pass http://backend;
proxy_next_upstream error timeout http_404;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
}
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题。
先感谢您。
对于尝试访问静态资产的 POST 请求,Nginx 会使用 HTTP 405 进行响应。
来自几年前的 Nginx 发行文档:
*) Feature: now Nginx returns the 405 status code for POST method
requesting a static file only if the file exists.
解决这个问题的一种方法是添加这一行,它会更改响应代码并将您发送到所请求的 URI:
error_page 405 =200 $uri;
您可以在这里找到其他解决方案:
http://invalidlogic.com/2011/04/12/serving-static-content-via-post-from-nginx/
我希望这有帮助。
| 归档时间: |
|
| 查看次数: |
18397 次 |
| 最近记录: |