nginx session 丢失解决
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx session 丢失解决相关的知识,希望对你有一定的参考价值。
今天配置一个新项目,nginx 反向代理java,验证码总是不通过,查询发现是session丢失,nginx 文档:
Sets a text that should be changed in the path attribute of the “Set-Cookie” header fields of a proxied server response. Suppose a proxied server returned the “Set-Cookie” header field with the attribute “path=/two/some/uri/”. The directive proxy_cookie_path /two/ /;
修改项目配置:
location /ckl { proxy_pass http://localhost:8080/ckl/; proxy_cookie_path /ckl /; #增加此行 proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off; proxy_read_timeout 60s; proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_set_header X-Forwarded-Proto https; proxy_intercept_errors on; }
重启nginx 解决
以上是关于nginx session 丢失解决的主要内容,如果未能解决你的问题,请参考以下文章
Nginx+IIS+Redis 处理Session共享问题 1