I have an Apache reverse proxy which forwards everything to Payara. It works, but my question is how can I make the context-roots (applications) forwarding dynamic?
This is the initial configuration:
<VirtualHost *:80>
...
ProxyPass / http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/
</VirtualHost>
With the above, a call to www.example.com will return Payara's index.html, but a call to www.example.com/myapp does not work, Payara returns 404 (/myapp is an application deployed on Payara).
In order for www.example.com/myapp to work, apparently, I need to specify the following:
<VirtualHost *:80>
...
ProxyPass / http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/
ProxyPass /myapp http://0.0.0.0:8080/myapp
ProxyPassReverse /myapp http://0.0.0.0:8080/myapp
</VirtualHost>
Is this the way it should be? Isn't there a configuration to automatically route any context-root? Editing Apache's config file every time I deploy a new application seems rather inconvenient.
I did try using *
when declaring ProxyPass
and ProxyPassReverse
(i.e. /*
) but it doesn't work.
Any help is greatly appreciated!