title: Apache + Tomcat: Using mod_proxy instead of AJP
body: <p>Is there any way I connect Apache to Tomcat using an HTTP proxy such that Tomcat gets the correct incoming host name rather than localhost? I'm using this directive in apache:</p>
  
  <pre><code>ProxyPass /path http://localhost:8080/path
  </code></pre>
  
  <p>But it comes through as localhost, which is useless when we have a bunch of sites on the same server. I could set the host manually in the server config:</p>
  
  <pre><code>&lt;Connector port="8080" protocol="HTTP/1.1"
             connectionTimeout="20000"
             proxyName="pretend.host" proxyPort="80" /&gt;
  </code></pre>
  
  <p>But that again doesn't serve more than one site. And I don't like the idea of using a different internal port for each site, that sounds really ugly.</p>
  
  <p>Is there no way to transfer the port when I proxy it?</p>
  
  <p>(If you ask why I don't just use AJP, the answer is <a href="https://stackoverflow.com/questions/246540/apache-tomcat-error-wrong-pages-being-delivered">this error</a>. I'm trying everything I can before giving up on <a href="https://serverfault.com/questions/589/alternatives-to-apache">Tomcat and Apache entirely</a>)</p>