tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <>
Subject Re: Apache Frontend Proxy/URL Rewrite Tomcat
Date Mon, 15 Sep 2008 06:54:22 GMT

----- Original Message ----- 
From: "roychan" <>
To: <>
Sent: Monday, September 15, 2008 4:55 AM
Subject: Apache Frontend Proxy/URL Rewrite Tomcat

> Hi Guru,
> I am trying to setup an apache in front of a java 
> application(Spring+Struts)
> on tomcat so that
> will route the traffic to
> I have tried the mod rewrite rule ^/(.*) http://localhost:8080/app/$1 [P]
> but when user try to access a secure area, the Spring bounce the user back
> to (instead of port 80 root)
> I have also tried the mod proxy to set up
> ProxyPass / http://localhost:8080/app
> ProxyPassReverse / http://localhost/app
> But now the cookie is not set correctly
> Then I tried to add proxyport="80" on the tomcat connector, this sorta 
> work,
> but it doesn't get rid of the /app/ part.
> So what is the correct way to set this up? Please advise!
> Thanks in advance!!

Not sure off hand... ie it may be possible for Apache to fix the problem you 
having... but look at this..

Notice that they keeping the contexts and sub contexts the same...

ie... its not the port thats catching you its because

are not the same in cookies...

It may be possible to do something like set TC's cookies to
but personally I dont like it...

Tomcat doesnt know the context is been manipulated... thats the problem

As I said... maybe there is a way... but I think more conventional solutions 
are to create a ROOT web app either as the web app, or one that redirects 
request to that real context...

If there is a way to change contexts in ProxyPass... I've never seen it...
Apache will do it... but it seems to break webapps...

Also from a philamamamasophamical point of view... ROOT is very special... 
typically in hosted sites its reserved for their use..
ie if you did manage to make a /webapp behave as the ROOT... what happens if 
you need to do that with another webapp?

ie ROOT often "needs" to become a kind of site index...
when you have webapps for accounting, and salaries, and wiki's and.... they 
cant all sit in ROOT... if you see what I'm trying to say...
A ROOT webapp is always going to end up being a "director", not a 

Have fun...
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action :

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message