Celso Marigo Jr
Celso Marigo Jr

Reputation: 754

Tomcat behind an apache proxy error on path

I'm trying to configure my apache 2.2 as a proxy to some applications on a server.

tomcat-jira : Installed with Jira´s installer; tomcat-dev : Just a container for another applications.

First, my httpd.conf is like this:

ProxyRequests Off
ProxyPreserveHost On

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass /jira http://dev.debian.local:8080/jira
ProxyPassReverse /jira http://dev.debian.local:8080/jira

ProxyPass /tomcat http://dev.debian.local:8088
ProxyPassReverse /tomcat http://dev.debian.local:8088

<Location /jira>
    Order allow,deny
    Allow from all
</Location>

<Location /tomcat>
   Order allow,deny
   Allow from all
</Location>

So when I type http://dev.debian.local/jira it works! But in tomcat-dev, http://dev.debian.local/tomcat, it shows the page, badbly, without styles, and when I click on manage-aps, it redirect to:

http://dev.debian.local/manager/html instead of http://dev.debian.local/tomcat/manager/html causing a 404 error.

On tomcat-jira it has a parameter to configure the application that is:

Its because is just one application, so it redirects properly. How can I do something like this on tomcat instance? Is there a context path for the tomcat root?

Upvotes: 3

Views: 2324

Answers (1)

Christopher Schultz
Christopher Schultz

Reputation: 20862

Using ProxyPass to change the path of a web application, as you can see, usually ruins everything.

Instead, you should do either this:

ProxyPass /tomcat http://dev.debian.local:8088/tomcat
ProxyPassReverse /tomcat http://dev.debian.local:8088/tomcat

or this:

ProxyPass / http://dev.debian.local:8088
ProxyPassReverse / http://dev.debian.local:8088

If you take the second option, re-name your "tomcat" web application to "ROOT" (case-sensitive: use capitals, even on a cass-insensitive filesystem).

Upvotes: 4

Related Questions