I am having a problem with setting up a reverse proxy to my Tomcat installation. The website itself is fully working if accessed directly via Tomcat on port 8080. The proxy I have set up broadly works but a few features are not working. For example:
It looks like the common theme is the session variables. All of these functions work when loading the site directly via Tomcat, so the website itself is not at fault.
I have modified the Apache SSL config file located in sites-available as follows:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPreserveHost On
ProxyPass "/" "http://localhost:8080/MyWebApp/"
ProxyPassReverse "/" "http://localhost:8080/MyWebApp/"
</VirtualHost>
</IfModule>
Thanks
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I have found the answer to this, it needs the following for the jsessionid to work:
ProxyPassReverseCookiePath “/” “http://localhost:8080/MyWebApp/” ProxyPassReverseCookieDomain “/” “http://localhost:8080/MyWebApp/”