This should work:
<VirtualHost 0.0.0.0:80>
ServerName app1.mycompany.com
ProxyPass / http://dev.mycompany.com:8080/app1/
ProxyPassReverse / http://dev.mycompany.com:8080/app1/
</VirtualHost>
Note however, that if the servlet at dev.mycompany.com uses the request URI to redirect the browser or generate a link in a document Apache doesn't understand (for example, a JNLP file), then it will fail to download because this will happen:
- The servlet detects the URI, /app1/
- The servlet generates the link, for example /app1/this_is_needed.jar
- The client tries to download the link, http://app1.mycompany.com/app1/this_is_needed.jar
- Since all requests gets redirected to dev.mycompany.com:8080/app1/, the request becomes http://dev.mycompany.com:8080/app1/app1/this_is_needed.jar, which doesn't exist.
This will not apply to html pages, because Apache will change the links (this is what the ProxyPassReverse is for). If you need to work around the error I described, you have two options:
- Make the webapp aware of the fact that it may have to serve paths different from the request URI. You'll need to find a way to specify these paths on the fly, using environmental variables (the SetEnv directive) for example
- Proxy the whole context, and in the webroot, place a simple page which redirects the user to /app1/