Trace: • Deployment: mod_proxy
Usually, a JVx application will be installed on a Java application server like Tomcat, Wildfly, etc. This will be good enough for small and simple scenarios but Enterprise installations are behind a load balanced web server like Apache http server, nginx, etc.
We'll show you a simple configuration option for Apache http server with mod_proxy:
Assume the application is available under http://localhost:8080/webapp/web/ui/
In order to use an Apache http server in front of Apache Tomcat, simple add following to the config file of Apache http server:
ProxyPass /webapp/PUSH ws://localhost:8080/webapp/web/ui/PUSH ProxyPassReverse /webapp/PUSH ws://localhost:8080/webapp/web/ui/PUSH ProxyPass /webapp http://localhost:8080/webapp timeout=300 ProxyPassReverse /webapp http://localhost:8080/webapp timeout=300
The application will be available under http://www.yourdomain.com/webapp/web/ui/
If you plan to use the application in the root of your domain, e.g. http://www.yourdomain.com/
You'll need a different configuration:
ProxyPassReverseCookiePath /webapp / ProxyPass /APP http://localhost:8080/webapp/web/ui/APP ProxyPassReverse /APP http://localhost:8080/webapp/web/ui/APP ProxyPass /PUSH ws://localhost:8080/webapp/web/ui/PUSH ProxyPassReverse /PUSH ws://localhost:8080/webapp/web/ui/PUSH ProxyPass /VAADIN http://localhost:8080/webapp/VAADIN timeout=300 ProxyPassReverse /VAADIN http://localhost:8080/webapp/VAADIN timeout=300 ProxyPass /UIDL http://localhost:8080/webapp/web/ui/UIDL timeout=300 ProxyPassReverse /UIDL http://localhost:8080/webapp/web/ui/UIDL timeout=300 ProxyPass / http://localhost:8080/webapp/web/ui timeout=300 ProxyPassReverse / http://localhost:8080/webapp/web/ui timeout=300
If above configuration is too complex or websockets don't work, just use this:
<Location /dri17/> ProxyPass http://localhost:8080/driprotocol/ ProxyPassReverse /driprotocol ProxyPassReverseCookiePath "/driprotocol/" "/dri17/" RewriteEngine on RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC] RewriteRule (.*)/driprotocol/(.*) ws://localhost:8080/driprotocol/$2 [P] </Location>
This configuration will map the external address https://www.mydom.ain/dri17/
to the internal host: http://localhost:8080/driprotocol/