You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jeff McAdams <je...@iglou.com> on 2006/11/01 03:41:43 UTC

Re: [users@httpd] Apache2 Proxy to Tomcat backend

Roger Hendrix at Baldor-IS wrote:
> I am trying to configure an Apache front-end Proxy Service to talk to
> a backend Tomcat Server.

> The Apache Server is:	 apache2-2.0.49-27.59
> The Tomcat Server is:  jakarta-tomcat-5.0.19-29.1

> The Apache Server is configured using ProxyPass and ProxyPreserveHost
> statements.

> Users can connect to the java application.

> My problem is that the java application requires COOKIES to be
> maintained at the user client level and these COOKIES are not being
> passed back to the user clients.

> If I connect directly to the tomcat server locally, all works
> correctly.

> I am sure it is something simple in the Apache Server Configuration.

We're doing basically this (and I respond because we're a SuSE shop and
those version numbers looked suspiciously like SuSE version
numbers...confirmed downthread, I see), but we're using JKMount with
mod_jk connectors rather than just proxying.  Well, I did have a proxy
setup as well, but it wasn't as clean of a setup...the mod_jk is better.

I see someone already suggested going to 2.2.x and using the
mod_proxy_ajp (which is the 2.2.x equivalent of mod_jk, but really much
better), but that you're having some trouble compiling 2.2.x.  You
really don't need to do that, nice though the 2.2.x stuff is.  I have a
setup using that as well...it really is nice, but I snagged packages
from ftp.suse.com for my SLES9 boxes, but I didn't turn up any s390
packages for 9.3 there, alas.

So, look into the mod_jk stuff using JKMount, it should do what you need
without the need of proxy'ing, and all the cookies will get set correctly.

Be aware that the mod_jk stuff doesn't rewrite cookie paths either, so
the URL path that the user sees will need to match the context path in
Apache, or else you'll have to change the way you're setting your
cookies in your Java code...probably just easier to make them match.
FWIW, we do a redirect on an empty path to redirect the user into the
context of the tomcat app so that the user sees the same URL path as the
tomcat app's context is set up to use.

I'm looking forward to SLES10, with pre-packaged apache 2.2.x and
switching over to the mod_proxy_ajp stuff, as it really is cleaner and
nicer all around and also has the ability to rewrite cookie paths to
match the rest of the proxy rewriting stuff.
-- 
Jeff McAdams
"They that can give up essential liberty to obtain a
little temporary safety deserve neither liberty nor safety."
                                       -- Benjamin Franklin