Session Expired on tomcat8 behind apache2 ProxyPas

2019-08-29 11:36发布

For a web application named whys written with VAADIN 7.3.8, i deployed a tomcat8 server behind an apache one (and redirected app.whys.fr to whys.fr:8080/Whys wich is my app location).

When i go on http://whys.fr:8080/Whys, everything looks good, but when i go on http://app.whys.fr, i get a session expired message immediatly, and no logs to tell me why (nothing in catalina.out).

You can test it by your own to see the difference ;).

Here is my proxy configuration :

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

and my tomcat Connector in server.xml:

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

apache2 has mod_proxy,mod_proxy_http and mod_proxy_connect enabled, timeout for session in web.xml is 30 mins.

EDIT: forgot to mention: my application is using @Push (vaadin feature)

1条回答
乱世女痞
2楼-- · 2019-08-29 12:15

The problem was with vaadin's Push.

With push activated, you need to redirect the cookies throught proxy too, in order to keep your session alive, else, it is instantly invalidated.

so here is how to do with a vaadin push application behind apache2 proxy :

<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>
查看更多
登录 后发表回答