nginx session 丟失解決
阿新 • • 發佈:2018-05-02
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 丟失解決