0

In the past I've used the host container to route the root uri to a tomcat webapp, like this:

<Host name="myapp.mydomain.com" appBase="webapps">
  <Alias>myapp</Alias>
  <Alias>myapp.mydomain.com</Alias>
  <Context path="/myapp" docBase="myapp" debug="0"></Context>
  <Context path="/" docBase="myapp" debug="0"></Context>
  <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/var/log/tomcat" prefix="myapp_access_log." suffix=".txt" pattern="combined" resolveHosts="false"/>
 </Host>

I'm now working with Varnish, though, and this method doesn't appear to work. Relevant code from my "default.vcl" file for Varnish specifies that GET and POST requests for this webapp are passed directly to the backend.. that back end is "127.0.0.1" though. Does that mean that Tomcat won't see the request being made for "myapp.mydomain.com" and it will instead see the request being made to "127.0.0.1"?

So with the above code in my server.xml nothing appears to have changed. I can access myapp.mydomain.com/myapp but myapp.mydomain.com is still going to the default tomcat page. Any clue what I can do to make this work?

Jared
  • 2,454
  • 1
  • 17
  • 13

1 Answers1

0

Oh! I realized that because tomcat/webapps/ROOT was still around it was defaulting there. I changed the name of ROOT, restarted tomcat and the forwarding began working.

Jared
  • 2,454
  • 1
  • 17
  • 13