I have apache server 2.4.18 on centos as a web server in the front end. Now I have multiple websites which are deployed on tomcat 8.0.33 as webapps in the default webapps folder of tomcat.
Configuration on apache end:
<VirtualHost 1.2.3.4:80>
ServerName abc.com
ServerAlias www.abc.com
ProxyPass / http://localhost:8079/abc/
ProxyPassReverse / http://localhost:8079/abc/
</VirtualHost>
<VirtualHost 1.2.3.4:80>
ServerName def.com
ServerAlias www.def.com
ProxyPass / http://localhost:8079/def/
ProxyPassReverse / http://localhost:8079/def/
</VirtualHost>
Two .war files by the name, abc.war & def.war are deployed to tomcat webapps folder.
abc.com works absolutely fine, as it is just an html site.
but def.com is a dynamic site & it has a login form on home page. The home page after successful login should load user profile page which is: login page url -> def.com user profile page -> def.com/profile.htm
Note that the home page loads successfully (means GET is executing successfully) on browser but when user tries to login(which is a POST request), it somehow tries to load: def.com/def/profile.htm
Also note that if I change configuration to :
<VirtualHost 1.2.3.4:80>
ServerName def.com
ServerAlias www.def.com
ProxyPass /def/ http://localhost:8079/def/
ProxyPassReverse /def/ http://localhost:8079/def/
</VirtualHost>
then I am successfully able to open def.com/def/ & I can also successfully able to login & open def.com/profile.htm but I want my home page to be on def.com
Most probably you need an added directive for the def page, as you mention there is login page and probably cookies, check how they are set at the backend.
My thoughts is you may need something like:
and perhaps maybe something similar with
ProxyPassReverseCookieDomain
.Review the mod_proxy docs if not for all the options you have
This is an interesting topic so if this is not your solution I would appreciate if you add your answer once you get to solve it.