我正在使用Tomcat 7,并使用nginx 1.5.7作为负载平衡器(在Windows 8上).我像这样配置nginx服务器.
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 something; location / { proxy_pass 127.0.0.1:8080/webapp/; } }我也重定向到我的主机"文件中:127.0.0.1 www.something
Also I redirect in my "hosts" file: 127.0.0.1 www.something
但是在登录或通过发布进行任何会话操作之后,我的web应用程序中没有会话保持,这就像没有会话参数一样.
But after login or any session operation via post, there is no session holding in my webapp, It is behaving like no session parameters.
通过我尝试在web.xml文件中添加的方式
By the way i tried to add in web.xml file
<session-config> <tracking-mode>COOKIE</tracking-mode> </session-config>但是什么都没有改变.
那么在这种状态下是什么问题?
So what is the problem in this state?
感谢您的帮助.
推荐答案您已在代理(/->/webapp)中更改了Web应用程序的路径.通常这是一个坏主意,因为它会破坏您需要修复的一堆东西.在这种情况下,可能是cookie路径是您的直接问题.要解决此问题,您需要使用proxy_cookie_path指令.修复该问题后,还会发现其他问题.
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.
实际上,最好将Web应用程序重新部署为ROOT Web应用程序,以便您的proxy_pass指令变为proxy_Pass 127.0.0.1:8080/;
You'd actually be better off redeploying your web application as the ROOT web app so that your proxy_pass directive becomes proxy_Pass 127.0.0.1:8080/;
更多推荐
使用Spring MVC无法在Tomcat和Nginx proxypass中保持HTTP会话
发布评论