如何阻止 NGINX RevProxy 跳转到无效网址?

问题描述

我正在尝试在我的家庭网络上设置一个非常基本的静态网页,其中包含指向我的 docker 容器的每个 Web 前端的链接。我在 Ubuntu 20.04 上使用本地安装的 Nginx

以传输为例,我的问题是,如果我浏览到 http://myserver.local/transmissionstuff/,我会被重定向http://myserver.local/transmission/web 并收到 404 错误

谁能指导我如何解决这个问题?

我的 Nginx.conf 文件如下所示:

server {
  listen 80;
  server_name 10.x.x.x #omitted;
  root /usr/share/Nginx/html;
  index index.html;

  location / {
    try_files $uri $uri/ =404;
#    auth_basic "Restricted Content";
#    auth_basic_user_file /etc/Nginx/.htpasswd;
  }
  location /transmissionstuff/ {
    proxy_pass http://10.x.x.x:9091/;
  }
  location /portainer/ {
    proxy_pass http://10.x.x.x:9000/;
  }

如果我浏览到 http://10.x.x.x/transmissionstuff/transmission/web,我会在浏览器中看到以下内容

409: Conflict

Your request had an invalid session-id header.

To fix this,follow these steps:

When reading a response,get its X-Transmission-Session-Id header and remember it
Add the updated header to your outgoing requests
When you get this 409 error message,resend your request with the updated header
This requirement has been added to help prevent CSRF attacks.

X-Transmission-Session-Id: cP12RoQvkRRp3Rg23OXbNFQeqBL4GTej4Qso3uf4SkJhx2qW

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)