Nginx 保留代理重定向标头

Nginx 保留代理重定向标头

所以问题只发生在一个http://example.com/login,另一个是正常工作。每次我的网站http://abcd.com/login总是重定向到http://example.com/。我尝试卷曲 -Ihttp://abcd.com/login这就是我得到的:

HTTP/1.1 302 Found
Server: nginx/1.14.0 (Ubuntu)
Date: Tue, 06 Oct 2020 08:39:05 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
Cache-Control: private, must-revalidate
Pragma: no-cache
Expires: -1
Location: http://example.com
Set-Cookie: XSRF-TOKEN=eyJpdiI6ImF4cXZxxxxxxxxxxxxxxxxxxxx
Set-Cookie: laravel_session=eyJpdxxxxxxxxxxxxxx

我尝试了 sub_filter,但是在这个页面上不起作用,有什么解决办法吗?这是我的配置文件

server {
    listen 80;
    location / {
        proxy_pass http://example.com;
        proxy_set_header Accept-Encoding "";
        sub_filter_once off;
        sub_filter_types text/css text/html text/javascript application/java;
        sub_filter 'example.com' 'abcd.com';
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

相关内容