I'm trying to set up Apache + Glassfish so that I can access two different webapps on the same physical host, differentiated by the hostname in the URL.
So if I visit http://host1.com, I'll get app1. If I visit http://host2.com, I'll get app2. host1 and host2 both resolve to the same IP address.
I've been able to get this working in a basic way with mod_proxy and Glassfish virtualservers using this guide. But the user still needs to specify the context-root for one of the apps, i.e. http://host1.com/app1.
How can I set things up so that both apps appear as the "root" in their respective URLs?
Do I need two separate Glassfish domains?
Here's the apache config I'm using:
<VirtualHost *:80> ProxyPreserveHost On ProxyPass / http://localhost:8080/app1 ProxyPassReverse / http://localhost:8080/app1 ServerName host1.com </VirtualHost> <VirtualHost *:80> ProxyPreserveHost On ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/app2 ServerName host2.com </VirtualHost>