You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Hartwig, Thomas" <t....@crapoud.com> on 2003/04/19 16:30:36 UTC

Re: Apache RewriteRule and Sessions [FIXED]

Hi Tony,

thanks for your response first, it gave me back the energy for looking 
further at least. ;-)
The problem was the cookie path. Tomcat and its persistent session 
manager stores the "JSESSIONID" cookie with the rewritten url, which 
then is not sent back to the server because the client browser sees only 
the original request url.
Unfortunately I did not found a configuration possibility to force the 
path of the session cookie of the persistent manager.
So I set a new cookie "JSESSIONID" with the absolut path "/", which then 
  is sent to the servlet.

Greetings
Thomas

Tony F. White wrote:
> Hi Thomas,
> 
> I do rewrites myself with Apache 1.3.xx with tomcat 4.1.24
> 
> What we do is just
> RewriteRule     ^/a.shtml /tomcat/servlet [PT]
> RewriteRule     ^/b.shtml /tomcat/servlet [PT]
> 
> and our sessions work fine...
> 
> note that you need to have the apache modules in the right order... (you
> probably know this already but better safe then sorry)
> 
> Cheers
> Tony
> ----- Original Message -----
> From: "Hartwig, Thomas" <t....@crapoud.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Thursday, April 17, 2003 1:36 AM
> Subject: Apache RewriteRule and Sessions
> 
> 
> 
>>I'm using Apache 2.0.43  + Tomcat 4.1.24 (mod_jk2) on a RedHat 8.0 box
>>and want to internal rewrite serveral URLs to a servlet. Unfortunately
>>tomcat does'nt set any cookies any more in the case of a internal
>>rewrite like the following and so I'm loosing the session:
>>
>>RewriteEngine On
>>RewriteRule     ^/a.shtml /tomcat/servlet [P,T=jserv-servlet]
>>RewriteRule     ^/b.shtml /tomcat/servlet [P,T=jserv-servlet]
>>
>>I know I could use "external" rewrite with the [R] flag to RewriteRule
>>but I would prefer the internal way as above.
>>
>>The core problem is that I'm want to share a session between serveral
>>urls like "/a.shtml" and "/b.shtml", perhaps there is a total other way
>>for this.
>>
>>Every little hint or pointer would help
>>Thanks
>>Thomas


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