I am using Tomcat 7 and using nginx 1.5.7 as a load-balancer(on Windows 8). I configurated nginx server like this.
server {
listen 80;
server_name www.something.com something.com;
location / {
proxy_pass http://127.0.0.1:8080/webapp/;
}
}
Also I redirect in my "hosts" file: 127.0.0.1 www.something.com
But after login or any session operation via post, there is no session holding in my webapp, It is behaving like no session parameters.
By the way i tried to add in web.xml file
<session-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
But nothing changes.
So what is the problem in this state?
Thanks for your helps.
You have changed the path to the web application in the proxy (/ -> /webapp). This is generally a bad idea as it breaks a whole bunch of stuff that you then need to fix. In this case it is probably the cookie path that is your immediate problem. To fix that you need to use the proxy_cookie_path directive. Once you fix that expect to find other problems.
You'd actually be better off redeploying your web application as the ROOT web app so that your proxy_pass directive becomes
proxy_Pass http://127.0.0.1:8080/;