views:

562

answers:

4

Hello,

I am using Tomcat 5.5.9 and Apache 2.x

We are trying to use a path name in ProxyPass that is different than the Tomcat context name.

ProxyPass /path http://localhost:8080/contextname

However, this does not work. When these two are the same then everything works fine.

Most examples I see on the net also have the path equal to the Tomcat context name.

I am using "context.xml" within the Tomcat context and do NOT have "server.xml" entries. Also, I am using plain httd.conf and NOT using any VirtualHost entries.

Any help is appreciated.

Regards,

Diptenu

+1  A: 

I believe you need both

ProxyPass /path/ http://localhost:8080/contextname/
ProxyPassReverse /path/ http://localhost:8080/contextname/

Any reason not to use mod_jk?

David Rabinowitz
Hello David,I did have both the ProxyPass and ProxyPassReverse commands even though I did not mention it in my message.As for why not use mod_jk I simply need to hide tomcat port from user access URL and nothing else so mod-proxy seems the simplest
Diptendu Dutta
Fixed the solution - you probably must have the slashes at the end of the URI. This is copied from my conf files.
David Rabinowitz
A: 
RewriteEngine on
RewriteRule ^/path$ /path/ [R]
RewriteRule ^/path/(.*) /contextname/$1 [P]

ProxyPass /contextname/ protocol://192.168.15.48:8080/contextname/
ProxyPassReverse /contextname/ protocol://192.168.15.48:8080/contextname/

Where "protocol"="http" in this case...

JL
A: 

Add a slash to both values:

ProxyPass /path/ http://localhost:8080/contextname/

Janning
A: 

Your problem are probably self-referential URLs that the application produces. There isn't much you can do about it except for a. changing the app or b. rewrite everything that it spits out. Option b can be very fragile. See the tomcat docs for more info.

vasquez