Hello Christopher,
Thanks for the help. I used your option #3 and it is working. I could not
use 2nd option as the requirement is to use /url1.
I set the cookie path "/" and it works fine now.
Thank you.
From: Christopher Schultz <[EMAIL PROTECTED]>
Reply-To: "Tomcat Users List" <users@tomcat.apache.org>
To: Tomcat Users List <users@tomcat.apache.org>
Subject: Re: Apache+Tomcat+mod_jk+cookie+Rewrite
Date: Fri, 05 Jan 2007 09:29:13 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Deval,
DEVAL SHAH wrote:
> I notice that because of url rewriting [RewriteRule] my cookie is not
> being passed to Tomcat.
It's not your rewrite rule that is dropping your cookie. It's the fact
that you are changing the path of the URI.
> RewriteRule ^/url1$ /MyApp/MyServlet [PT]
I'm guessing that your webapp emits a cookie with the path of "/MyApp".
If your app also emits URLs of the form http://whatever/url1/MyServlet,
then the browser will not send the cookie along with the request
(because the cookie belongs to /MyApp, not /url1).
You can probably verify this using a packet sniffer or a much more
convenient tool like LiveHttpHeaders for Mozilla Firefox or perhaps a
plug-in for MSIE or another browser.
> How do i go about passing the cookie to the servlet using RewriteRule ?
You will need to do one of several things:
1. Stop using this other URL.
2. Move that URL-to-be-re-written inside the URL space of your
webapp (i.e. change /url1 to /MyApp/url1).
3. Modify your cookie configuration such that the path will be set
to "/" instead of "/MyApp" (I think single-sign-op will do this,
but there are probably other ways, too).
4. Use javascript to mutate the cookie and send (another copy) to
the browser with the path of "/url1" (you're already using javascript
in your onsubmit event handler, so this should always work).
I highly recommend #2. It's pretty easy, and you don't have to resort to
any hacks in your application to make it work (other than the obvious
hack of using mod_rewrite in the first place).
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFnmC59CaO5/Lv0PARAl+YAKCy7JXb2gmrG7Yv1jMRvlrXMqvmMACgoCEc
F9aJLnjBWwGCAJAkMdN01fU=
=A2S+
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]