1.host、端口转换,路劲不变,cookie不会丢失
location /sjzt {
proxy_pass http://127.0.0.1:9081/sjzt;
}
通过浏览器访问http://127.0.0.1/sjzt时,浏览器正常发送cookie。
2.路径发生变化,cookie丢失
location /sjzt-dev {
proxy_pass http://127.0.0.1:9081/sjzt;
需要修改配置,设置proxy_cookie_path,实现cookie的传递。
location /sjzt-dev {
proxy_pass http://127.0.0.1:9081/sjz;
proxy_cookie_path /sjzt /sjzt-dev;
}