Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Tomcat 6.x installed and Apache 2.2.x.

I want to map my Applications running on tomcat to sub-domains without having to specify ports and contexts.

I want: to point to

I have tried creating Virtual Host entries different combonations of mod_proxy and mod_rewrite and using ajp but I can't get it set up to do this.

share|improve this question
up vote 0 down vote accepted

I ended up ditching Apache Tomcat and just used Jetty and made the applications their own ROOT app context. Not optimal but it is light weight enough until I can figure out how to actually host multiple apps out of a Servlet container and have them seamlessly route to and from subdomains. Using Tomcat Virtual hosts directly outside Tomcat was suggested offline by someone, I will investigate that as well.

share|improve this answer

This should work:


    ProxyPass /
    ProxyPassReverse /

Note however, that if the servlet at 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:

  1. The servlet detects the URI, /app1/
  2. The servlet generates the link, for example /app1/this_is_needed.jar
  3. The client tries to download the link,
  4. Since all requests gets redirected to, the request becomes, 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:

  1. 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
  2. Proxy the whole context, and in the webroot, place a simple page which redirects the user to /app1/
share|improve this answer
this doesn't work it just appends the /app1 over and over to the URL. – Jarrod Roberson Mar 9 '11 at 4:39
@fuzzy-lollipop: The behavior you described suggests that you specified the same host name after the ServerName and the ProxyPass directives. The host names should be different. – Lacek Mar 9 '11 at 21:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.