tomcat-users mailing list archives

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

----- Original Message ----- 
From: "roychan" <email2roy@gmail.com>
To: <users@tomcat.apache.org>
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
> http://www.somedomain.com/ will route the traffic to
> http://www.somedomain.com:8080/app/
>
> 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 http://www.somedomain.com:8080/app/ (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!!

Roychan...
Not sure off hand... ie it may be possible for Apache to fix the problem you 
having... but look at this..
http://members.cox.net/midian/howto/apache+tomcat+proxy3.htm#3.1
and
http://confluence.atlassian.com/display/DISC/Using+Virtual+Hosts+on+both+Apache+and+Tomcat

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

ie... its not the port thats catching you its because
/webapp
becomes
/somethingelse

are not the same in cookies...

It may be possible to do something like set TC's cookies to
emptySessionPath
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 
specialist...

Have fun...
---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message