IT Certificaions

Google Cloud Platform

Monday, September 12, 2011

Struts2: Session Problem (after reverse proxy) on Apache Server

Session parameters are stored in a Struts2 session map in action using the SessionAware interface. 
Application's context path is  /MyApp
Use Apache server with an inverse proxy redirect that makes the URL http://www.appdomain.com/ point to local tomcat on localhost:8080/MyApp, Struts2 session handling doesn't work.

 Solution:
Set your ProxyPassReverseCookie path properly":
        ProxyPass / http://localhost:8080/VicWalks/
        ProxyPassReverse / http://localhost:8080/VicWalks/
        ProxyPassReverseCookiePath /VicWalks /
 For more info:
ProxyPassReverseCookiePath directives. See:
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreversecookiedomain