nginx 反向代理处理 http Location 重定向问题
方案一:
服务器A -> 后端服务器B
服务器A 代理后端流量,有时后端服务器会发送一些重定向响应,用 http 的 Location 表示重定向的地址,此时,需要把 Location 的 ip 修改为服务器A 的 ip
location / {
proxy_pass http://y.y.y.y:1234;
proxy_redirect http://y.y.y.y:1234/ http://x.x.x.x:1234/;
}
方案二:
location / {
proxy_pass http://y.y.y.y:1234;
proxy_redirect ~*https://[^/]+(/.*)$ $1;
}

浙公网安备 33010602011771号