Nginx:当尝试打开目录时,代理通道会添加端口号,而末尾没有斜杠

Nginx:当尝试打开目录时,代理通道会添加端口号,而末尾没有斜杠

当目录的 URL 中没有尾随斜杠并且添加端口和超时页面时,除此部分外,一切运行良好。

这是反向代理设置

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name example.org;
    port_in_redirect off;

    # SSL
    SSl setup here


# reverse proxy
location / {
proxy_pass https://ip:1981;
proxy_ssl_trusted_certificate ssl/example.pem;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
proxy_http_version  1.1;
proxy_cache_bypass  $http_upgrade;

proxy_set_header Upgrade            $http_upgrade;
proxy_set_header Connection         "upgrade";
proxy_set_header Host               $host;
proxy_set_header X-Real-IP          $remote_addr;
proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto  $scheme;
proxy_set_header X-Forwarded-Host   $host;
proxy_set_header X-Forwarded-Port   $server_port;
    }

}

相关内容