title: How to mask a tomcat app behind an apache subdomain?
body: <p>I have two separate servers: an Apache public server and an internal Tomcat one. I would like our users to be able to use our Tomcat apps without exposing the details of our implementation (actual port, server name, context) through the public Apache server like this:</p>
  
  <p><code><a href="http://credits.publicdomain.com/servlet" rel="nofollow">http://credits.publicdomain.com/servlet</a></code> </p>
  
  <p>instead of</p>
  
  <p><code><a href="http://tomcat.internaldomain.com:8082/CreditsApp/servlet" rel="nofollow">http://tomcat.internaldomain.com:8082/CreditsApp/servlet</a></code> </p>
  
  <p>How can I configure my Apache server to mask requests to our Tomcat apps this way? Is using Apache modules such as mod_rewrite or mod_proxy the most straightforward approach?</p>
  
  <p>I have tried this configuration for a VirtualHost in Apache, which works for the first servlet. However it seems to disable Tomcat to keep the session from the first servlet to any other servlet you go afterwards:</p>
  
  <p><code>
      ServerName credits.publicdomain.com </p>
  
  <pre><code>ProxyRequests Off
  ProxyPreserveHost On
  
  &lt;Proxy *&gt;
      Order deny,allow
      Allow from all
  &lt;/Proxy&gt;                        
  
  ProxyPass        / http://tomcat.internaldomain.com:8082/CreditsApp/
  ProxyPassReverse / http://tomcat.internaldomain.com:8082/CreditsApp/
  </code></pre>
  
  <p></code></p>
  
  <p>Am I missing some additional configuration in my Tomcat server in order to work without the context between servlets? </p>