1. If it is only host and port conversion, the cookie will not be lost. For example:
location /project { proxy_pass http://127.0.0.1:8080/project;
2. If the path also changes, you need to set the path conversion of the cookie. The configuration of nginx.conf is as follows:
location /proxy_path { proxy_pass http://127.0.0.1:8080/project;
proxy_pass http://127.0.0.1:8080/project;
proxy_cookie_path /project /proxy_path;
}
location /project { proxy_pass http://127.0.0.1:8080/project;
}
2. If the path also changes, you need to set the path conversion of the cookie. The configuration of nginx.conf is as follows:
location /proxy_path { proxy_pass http://127.0.0.1:8080/project;
}
Read the documentation in detail: http://nginx.org/en/docs/http/ngx_http_proxy_module.html?&_ga=1.161910972.1696054694.1422417685#proxy_cookie_path
Then you can output the project cookie to proxy_path. The correct configuration is:
proxy_pass http://127.0.0.1:8080/project;
proxy_cookie_path /project /proxy_path;
}