nginx session loss solution

Configure a new project today, nginx reverse proxy java, the verification code always fails, the query found that the session is lost, the nginx document:

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/ /;

Modify the project configuration:

 location /ckl {
                proxy_pass  http://localhost:8080/ckl/;
                proxy_cookie_path /ckl /; #Add this line
                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;
        }

Restart nginx to solve

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325202346&siteId=291194637