tomcat - session is lost when nginx uses proxy_pass reverse proxy
滿天的星座
滿天的星座 2017-05-16 17:27:05
0
1
754

When configuring url rewrite in nginx, in order to keep the URL in the browser address bar unchanged, proxy_pass reverse proxy is used, but a new jsessionid will be generated every time. The specific configuration is as follows:

server {
        listen       80;
        server_name  www.demo.com;
        root /www/webapps/demo;
        index index.html index.htm;

        location / {
          proxy_pass http://localhost:81/;
          include naproxy.conf;
        }
    }

I have configured the app in tomcat as a virtual host!

According to this post, I also tried it, but it didn’t work!

What’s strange to me is that I directly use locahost:81 to access the application, and the cookie’s Path=/, which is normal!
But when you use www.demo.com to access it, the damn Path becomes abnormal!

Kneel down and wait for the master 1

滿天的星座
滿天的星座

reply all(1)
PHPzhong
proxy_set_header Cookie $http_cookie; 
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template