admin avatar

解决nginx反向代理验证码不显示的方法

🕜 by admin

先看代码

1
2
3
4
5
6
7
8
9
10
11
12
location / {
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:9090;
        proxy_read_timeout 120;
        proxy_send_timeout 120;
    }

上面的代码会导致验证码无法正确显示

正确的代码应该是下面的

1
2
3
4
5
6
7
8
9
10
11
12
location ~ / {
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:9090;
        proxy_read_timeout 120;
        proxy_send_timeout 120;
    }

💘 相关文章

写一条评论