You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew Bruno <an...@gmail.com> on 2010/03/31 09:02:41 UTC

AJP java client

Hello all,

I have a situation where I wish to break up my web application, but wish to
maintain the same domain as the front end URL.

All customers log in via a single domain using their email address as a
username.

The email address gives them access to their customer repository data
(lucene, etc), which is only accessible by that customer account.

I would like to split the web app up, so that the front end server has
smarts to know which backend tomcat server to redirect to.

As far as I know, Apache AJP can be configured to redirect to different
tomcat backend servers by implementing rules, ideally URL based.  But for
me, the URL is always the same.

So, I was wondering if there was a way to code an AJP client inside a front
end tomcat server, so that I could redirect to whatever backend server the
business rules decided.

1. Login Screen on front end server
2. User attempts to log in, verify against DB, and then work out which back
end tomcat server to AJP to.
3. All traffic goes via front server one to the decided backend server 2.

any other ideas are also welcome....

Thanks
Andrew

Re: AJP java client

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew,

On 3/31/2010 4:39 PM, Andrew Bruno wrote:
> Thanks for the pointers to the jMeter AJP client and also the URL session &
> jvm route idea.
> 
> If I used the jSession idea, I am assuiming I could filter apache on "." +
> jvmRoute ... right? and redirect to relevant AJP/Tomcat.

mod_jk already knows that a .jvmRoute on the end of a session id should
route the request to a particular backend: there's no work for you to
do. You basically just have to make sure that your loopback request
includes the session id in one way or another. Basically, you're
performing a MITM where the server is the MITM. :)

> http://randomcoder.com/articles/jsessionid-considered-harmful

Did you actually read that article? That's like saying an article titled
"muscle tearing considered harmful" is a good reason not to exercise or
lift weights. :(

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuzx10ACgkQ9CaO5/Lv0PAlPwCfYLewEdD3p985xaDayWylBqiJ
Sl4AnjhzRs1Pryw5xzmOU0EmLasyej1u
=0/eJ
-----END PGP SIGNATURE-----

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


Re: AJP java client

Posted by Andrew Bruno <an...@gmail.com>.
http://randomcoder.com/articles/jsessionid-considered-harmful


On Thu, Apr 1, 2010 at 7:39 AM, Andrew Bruno <an...@gmail.com> wrote:

> Thanks for the pointers to the jMeter AJP client and also the URL session &
> jvm route idea.
>
> If I used the jSession idea, I am assuiming I could filter apache on "." +
> jvmRoute ... right? and redirect to relevant AJP/Tomcat.
>
>
>
> On Thu, Apr 1, 2010 at 1:11 AM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Andrew,
>>
>> On 3/31/2010 3:02 AM, Andrew Bruno wrote:
>> > I would like to split the web app up, so that the front end server has
>> > smarts to know which backend tomcat server to redirect to.
>> >
>> > As far as I know, Apache AJP can be configured to redirect to different
>> > tomcat backend servers by implementing rules, ideally URL based.  But
>> for
>> > me, the URL is always the same.
>> >
>> > So, I was wondering if there was a way to code an AJP client inside a
>> front
>> > end tomcat server, so that I could redirect to whatever backend server
>> the
>> > business rules decided.
>>
>> You can force Apache httpd to direct a request to a particular backend
>> Tomcat server by putting a specially-crafted jsessionid into the URL. If
>> you don't use cookies to track the session for these requests, you
>> should be able to create a URL like this:
>>
>> URL + ";jsessionid=" + sessionId + "." + jvmRoute + "?" + queryString
>>
>> Would something like this work for you?
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.10 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iEYEARECAAYFAkuzV/kACgkQ9CaO5/Lv0PBfPQCgutR+7yGVAYI3MbKkMM1u5Rlp
>> KzUAnjojlVj4Z6rJinYPVvQ1OV4590Ar
>> =qOiH
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

Re: AJP java client

Posted by Andrew Bruno <an...@gmail.com>.
Thanks for the pointers to the jMeter AJP client and also the URL session &
jvm route idea.

If I used the jSession idea, I am assuiming I could filter apache on "." +
jvmRoute ... right? and redirect to relevant AJP/Tomcat.


On Thu, Apr 1, 2010 at 1:11 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Andrew,
>
> On 3/31/2010 3:02 AM, Andrew Bruno wrote:
> > I would like to split the web app up, so that the front end server has
> > smarts to know which backend tomcat server to redirect to.
> >
> > As far as I know, Apache AJP can be configured to redirect to different
> > tomcat backend servers by implementing rules, ideally URL based.  But for
> > me, the URL is always the same.
> >
> > So, I was wondering if there was a way to code an AJP client inside a
> front
> > end tomcat server, so that I could redirect to whatever backend server
> the
> > business rules decided.
>
> You can force Apache httpd to direct a request to a particular backend
> Tomcat server by putting a specially-crafted jsessionid into the URL. If
> you don't use cookies to track the session for these requests, you
> should be able to create a URL like this:
>
> URL + ";jsessionid=" + sessionId + "." + jvmRoute + "?" + queryString
>
> Would something like this work for you?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkuzV/kACgkQ9CaO5/Lv0PBfPQCgutR+7yGVAYI3MbKkMM1u5Rlp
> KzUAnjojlVj4Z6rJinYPVvQ1OV4590Ar
> =qOiH
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: AJP java client

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew,

On 3/31/2010 3:02 AM, Andrew Bruno wrote:
> I would like to split the web app up, so that the front end server has
> smarts to know which backend tomcat server to redirect to.
> 
> As far as I know, Apache AJP can be configured to redirect to different
> tomcat backend servers by implementing rules, ideally URL based.  But for
> me, the URL is always the same.
> 
> So, I was wondering if there was a way to code an AJP client inside a front
> end tomcat server, so that I could redirect to whatever backend server the
> business rules decided.

You can force Apache httpd to direct a request to a particular backend
Tomcat server by putting a specially-crafted jsessionid into the URL. If
you don't use cookies to track the session for these requests, you
should be able to create a URL like this:

URL + ";jsessionid=" + sessionId + "." + jvmRoute + "?" + queryString

Would something like this work for you?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuzV/kACgkQ9CaO5/Lv0PBfPQCgutR+7yGVAYI3MbKkMM1u5Rlp
KzUAnjojlVj4Z6rJinYPVvQ1OV4590Ar
=qOiH
-----END PGP SIGNATURE-----

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


Re: AJP java client

Posted by Bill Barker <bi...@verizon.net>.
As far as I know, only Apache Jakarta-JMeter has a Java AJP client.  You can 
look there for how to set one up.

"Andrew Bruno" <an...@gmail.com> wrote in message 
news:t2o9b906c961003310002j519ef867p3ead196614483adf@mail.gmail.com...
> Hello all,
>
> I have a situation where I wish to break up my web application, but wish 
> to
> maintain the same domain as the front end URL.
>
> All customers log in via a single domain using their email address as a
> username.
>
> The email address gives them access to their customer repository data
> (lucene, etc), which is only accessible by that customer account.
>
> I would like to split the web app up, so that the front end server has
> smarts to know which backend tomcat server to redirect to.
>
> As far as I know, Apache AJP can be configured to redirect to different
> tomcat backend servers by implementing rules, ideally URL based.  But for
> me, the URL is always the same.
>
> So, I was wondering if there was a way to code an AJP client inside a 
> front
> end tomcat server, so that I could redirect to whatever backend server the
> business rules decided.
>
> 1. Login Screen on front end server
> 2. User attempts to log in, verify against DB, and then work out which 
> back
> end tomcat server to AJP to.
> 3. All traffic goes via front server one to the decided backend server 2.
>
> any other ideas are also welcome....
>
> Thanks
> Andrew
> 


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