views:

756

answers:

3

I've got a tomcat instance with several apps running on it... I want the root of my new domain to go to one of these apps (context path of blah).. so I have the following set up:

<Location />
    ProxyPass ajp://localhost:8025/blah
    ProxyPassReverse ajp://localhost:8025/blah
</Location>

it kinda works... going to mydomain.com/index.jsp works except the app still thinks it needs to add the /blah/ to everything like css and js.. is there something I can do without deploying the app to ROOT or changing the tomcat server config? I'd like to keep all this kind of thing on the apache side, if it's possible.

I'm thinking I may not be understanding the proxypassreverse directive..

A: 

it looks like this is kind of a pain in the rear.

apache is literally rewriting pages as it serves them...

I think I'll go a different route.

danb
+2  A: 

If you're wanting to server the app the /, Tomcat expects the app to be mounted at /, and have the name of ROOT. At least that's how I've always handled the situation personally. Even if you just symlink the app into ROOT, that should mitigate your problems. If you have an app placed in ${tomcat_home}/webapps/newapp, then Tomcat deploys it with a context of /newapp. At least, that's been the case in my history. Also, not sure if it matters but I've always used:

ProxyPass / ajp://localhost:8025/blah
ProxyPassReverse / ajp://localhost:8025/blah
f4nt
A: 

If you configure hosts on the Tomcat side as well then you can proxy to them and eliminate the context path for non-root webapps--in Tomcat server.xml:

<Host name="myhost">
  <Context path="" docBase="/path/to/files" />
</Host>

And on the Apache side:

<VirtualHost *:80>
  ServerName myhost
  ProxyPass / ajp://myhost:8009/
  ProxyPassReverse / ajp://myhost:8009/
</VirtualHost>

Hope that helps.

Matt Woodward