从 nginx proxy_pass 中删除路径的开头

Pau*_*BGD 3 nginx proxypass node.js

为了在此服务器上运行的几个应用程序上删除端口的使用,我一直在使用 nginx 的 proxy_pass 来做到这一点。但是,由于某种原因,实际的 url 正在传递给应用程序。有没有办法让它认为/panel真的只是/

location /panel {
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   Host      $http_host;
    proxy_pass         http://127.0.0.1:8082/;
}
Run Code Online (Sandbox Code Playgroud)

Mat*_*Cas 9

您需要添加尾部斜杠

location /panel/ {
proxy_set_header   X-Real-IP $remote_addr;
proxy_set_header   Host      $http_host;
proxy_pass         http://127.0.0.1:8082/;
}
Run Code Online (Sandbox Code Playgroud)