IdentityServer4集成到Nginx总是跳转到80端口的问题

问题:

  跳转的时候总是跳转到80端口的登录Url上,

解决办法:

  改为:proxy_set_header Host $host:$server_port;

  完整节点的配置如下:

server {
        listen       9000;
        server_name  172.16.17.252;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        proxy_buffer_size   128k;
        proxy_buffers   4 256k;
        proxy_busy_buffers_size   256k;
        large_client_header_buffers 4 16k;
        
        location / {
            fastcgi_buffers 16 16k;
            fastcgi_buffer_size 32k;
            proxy_pass http://127.0.0.1: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_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;#must be set or wrong url
            proxy_set_header X-Forwarded-Proto $scheme;#must be set or wrong url
        }
}

 

posted @ 2022-07-29 12:00  星星c#  阅读(178)  评论(0编辑  收藏  举报