asp.net core mvc在使用nginx做反向代理,如果存在端口号的情况

如果默认不是80端口,在加授权后,跳转容易到默认端口,记得在nginx设置中的proxy_set_header   Host $host:$server_port;中加上$server_port,下文中红色字体

server {
    listen        8080;
    server_name   example.com *.example.com;
    location / {
        proxy_pass         http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host:$server_port;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }
}


版权声明:本文为xhlyp3原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。