You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jerry Malcolm <te...@malcolms.com> on 2016/12/24 16:08:27 UTC

Maintaining Session with Apache RewriteRule

I have an app that runs in a single WAR file deployment (single webapp 
context).  I added some Apache RewriteRule statements to hide the actual 
URLs for pages in the webapp.  All of the rules still resolve to the 
single WAR file context.  But the problem is now I get a different 
session on each page.  I need to pass a session variable from page to 
page.  Everything worked with a single session until I moved to the 
RewriteRule statements.  Am I missing some flag in the RewriteRule or a 
Tomcat config option that will allow me to keep one session even with 
RewriteRules in effect?

Here's one of the Apache statements:

          RewriteRule ^/precheckout$ 
/order/jsp/user/termsandconditions.jsp    [PT]

What am I missing?


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


Re: Maintaining Session with Apache RewriteRule

Posted by Rainer Jung <ra...@kippdata.de>.
Am 24.12.2016 um 19:58 schrieb Jerry Malcolm:
> Mark,
>
> Thanks, but what can I do to correct it?

> On 12/24/2016 11:09 AM, Mark Thomas wrote:
>> On 24/12/2016 16:08, Jerry Malcolm wrote:
>>> I have an app that runs in a single WAR file deployment (single webapp
>>> context).  I added some Apache RewriteRule statements to hide the actual
>>> URLs for pages in the webapp.  All of the rules still resolve to the
>>> single WAR file context.  But the problem is now I get a different
>>> session on each page.  I need to pass a session variable from page to
>>> page.  Everything worked with a single session until I moved to the
>>> RewriteRule statements.  Am I missing some flag in the RewriteRule or a
>>> Tomcat config option that will allow me to keep one session even with
>>> RewriteRules in effect?
>>>
>>> Here's one of the Apache statements:
>>>
>>>           RewriteRule ^/precheckout$
>>> /order/jsp/user/termsandconditions.jsp    [PT]
>>>
>>> What am I missing?
>> You are missing that the session cookie has a path and your rewrite
>> rules are changing the path and therefore preventing the client from
>> returning cookie.

http://httpd.apache.org/docs/2.4/en/mod/mod_proxy.html#proxypassreversecookiepath

Regards,

Rainer


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


Re: Maintaining Session with Apache RewriteRule

Posted by Jerry Malcolm <te...@malcolms.com>.
Mark,

Thanks, but what can I do to correct it?


On 12/24/2016 11:09 AM, Mark Thomas wrote:
> On 24/12/2016 16:08, Jerry Malcolm wrote:
>> I have an app that runs in a single WAR file deployment (single webapp
>> context).  I added some Apache RewriteRule statements to hide the actual
>> URLs for pages in the webapp.  All of the rules still resolve to the
>> single WAR file context.  But the problem is now I get a different
>> session on each page.  I need to pass a session variable from page to
>> page.  Everything worked with a single session until I moved to the
>> RewriteRule statements.  Am I missing some flag in the RewriteRule or a
>> Tomcat config option that will allow me to keep one session even with
>> RewriteRules in effect?
>>
>> Here's one of the Apache statements:
>>
>>           RewriteRule ^/precheckout$
>> /order/jsp/user/termsandconditions.jsp    [PT]
>>
>> What am I missing?
> You are missing that the session cookie has a path and your rewrite
> rules are changing the path and therefore preventing the client from
> returning cookie.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2016.0.7924 / Virus Database: 4739/13644 - Release Date: 12/23/16


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


Re: Maintaining Session with Apache RewriteRule

Posted by Mark Thomas <ma...@apache.org>.
On 24/12/2016 16:08, Jerry Malcolm wrote:
> I have an app that runs in a single WAR file deployment (single webapp
> context).  I added some Apache RewriteRule statements to hide the actual
> URLs for pages in the webapp.  All of the rules still resolve to the
> single WAR file context.  But the problem is now I get a different
> session on each page.  I need to pass a session variable from page to
> page.  Everything worked with a single session until I moved to the
> RewriteRule statements.  Am I missing some flag in the RewriteRule or a
> Tomcat config option that will allow me to keep one session even with
> RewriteRules in effect?
> 
> Here's one of the Apache statements:
> 
>          RewriteRule ^/precheckout$
> /order/jsp/user/termsandconditions.jsp    [PT]
> 
> What am I missing?

You are missing that the session cookie has a path and your rewrite
rules are changing the path and therefore preventing the client from
returning cookie.

Mark


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