【发布时间】:2023-04-03 23:32:01
【问题描述】:
我有 nginx 代理到应用服务器,配置如下:
location /app/ {
# send to app server without the /app qualifier
rewrite /app/(.*)$ /$1 break;
proxy_set_header Host $http_host;
proxy_pass http://localhost:9001;
proxy_redirect http://localhost:9001 http://localhost:9000;
}
对 /app 的任何请求都会转到:9001,而默认站点托管在:9000。
GET 请求工作正常。但是,每当我向 /app/any/post/url 提交 POST 请求时,都会导致 404 错误。通过 GET /app/any/post/url 在浏览器中直接点击 url 会按预期点击应用服务器。
我在网上找到了其他有类似问题的人并添加了
proxy_set_header 主机 $http_host; 但这并没有解决我的问题。
感谢任何见解。
谢谢。
【问题讨论】: