对于使用 VAADIN 7.3.8 编写的名为 whys 的 Web 应用程序,我在 apache 服务器后面部署了一个 tomcat8 服务器(并将 app.whys.fr 重定向到 whys.fr:8080/Whys,这是我的应用程序位置)。
当我继续 http://whys.fr:8080/Whys ,一切看起来都不错,但是当我继续 http://app.whys.fr ,我立即收到一条 session 过期消息,并且没有日志告诉我原因(catalina.out 中没有任何内容)。
你可以自己测试一下,看看有什么不同;)。
这是我的代理配置:
<VirtualHost *:80>
ServerName app.whys.fr
ProxyRequests On
ProxyPass / http://localhost:8080/Whys/
ProxyPassReverse / http://localhost:8080/Whys/
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
<VirtualHost *:80>
ServerName whys.fr
</VirtualHost>
和我在 server.xml 中的 tomcat 连接器:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
apache2 启用了 mod_proxy、mod_proxy_http 和 mod_proxy_connect,web.xml 中的 session 超时为 30 分钟。
编辑:忘了提及:我的应用程序正在使用@Push(vaadin 功能)
最佳答案
问题出在 vaadin 的 Push 上。
激活推送后,您还需要通过代理重定向 cookie,以保持您的 session 有效,否则,它会立即失效。
所以这里是如何处理 apache2 代理后面的 vaadin 推送应用程序:
<VirtualHost *:80>
ServerName yourdomain.tld
ProxyRequests On
ProxyPass / http://localhost:8080/yourApplication/
ProxyPassReverse / http://localhost:8080/yourApplication/
ProxyPassReverseCookiePath /yourApplication /
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
关于apache - session 在 apache2 ProxyPass 后面的 tomcat8 上过期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28519302/