You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by "Robert G." <ga...@mercon24.de> on 2013/01/06 15:37:29 UTC

Mod Rewrite and Session handling

Hey guys, 

i have the following problem:

I use sometimes CMS to show content. The CMS hyperlink I modify with Apache
mod rewrite like:

*user types in:* domain.tld/content/somecontent.html
*apche mod rewrite sends to ofbiz:
*domain.tld/ecommerce/control/cms/content/somecontent

It works, that I get shown the content, but I loose the session, so ofbiz
creates a new cookie / session. When I directly type the correct ofbiz url,
than the session is the same as before, and everything works fine.

Do anyone has an idea how I can fix it?

thanks in advance



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Mod-Rewrite-and-Session-handling-tp4638721.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Mod Rewrite and Session handling

Posted by "Robert G." <ga...@mercon24.de>.
ok, for everyone who also had that problem, I found a solution:

Because I changed with my mod rewrite the root webapp path the cookie path
is not found anymore with the rewrite, so I had to connect the new "virtual"
one with the real one.

Lets assume I put all cms sites to a rewritten path of like "content":
RewriteRule ^/?content/(.+)\.html$ /ecommerce/control/cms/content/$1 [PT]

now I have to tell apache or the browser where to find the real path with:
ProxyPassReverseCookiePath /ecommerce/ /content/

with that entry everything works fine!

greetings




--
View this message in context: http://ofbiz.135035.n4.nabble.com/Mod-Rewrite-and-Session-handling-tp4638721p4639918.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Mod Rewrite and Session handling

Posted by "Robert G." <ga...@mercon24.de>.
does someone has any idea? 



--
View this message in context: http://ofbiz.135035.n4.nabble.com/Mod-Rewrite-and-Session-handling-tp4638721p4639909.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Mod Rewrite and Session handling

Posted by "Robert G." <ga...@mercon24.de>.
Hey Jacques, 

thank you for your help. I allready use mod_proxy_ajp, cause it was for me
the easiest way to frontened apache.

The QSA Option after the rewrite rules does not help unfortunately.

To more specify my chain:

Apache conf:
/ProxyRequests Off
<Proxy *>
        AddDefaultCharset off
        Order deny,allow
        ALlow from all
</Proxy>

ProxyVia On/


/
<VirtualHost *:80>
        ServerName localhost
        ServerAdmin gan@mercon24.de

        ProxyRequests Off
        ProxyPreserveHost On
        proxyPass / ajp://localhost:8010/

        RewriteEngine On
        RewriteRule ^/(images/.+);jsessionid=\w+$ /$1 [PT]
        RewriteRule ^/?inhalt/(.+)\.html$ /shop/control/cms/inhalt/$1 [PT]
</VirtualHost>
/

Problem: The browser loose the session cookie or expire the session after
entering a rewritten url (call of TLD/inhalt/XXX.html lets the session
expirering). The website behind this url (real url:
TLD/shop/control/cms/inhalt/XXX is correctly shown.

In the case that I call the ofbiz url directly (TLD/shop/control...) than
the session does not expire, everything is fine.

Hopefully anyone has an idea how to fix it.

thanks in advance, Robert









--
View this message in context: http://ofbiz.135035.n4.nabble.com/Mod-Rewrite-and-Session-handling-tp4638721p4638734.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Mod Rewrite and Session handling

Posted by Jacques Le Roux <ja...@les7arts.com>.
You might be interested by http://httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa, just a bet

Also, if you are not usint it, you could try mod_proxy_ajp
https://cwiki.apache.org/confluence/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-ApacheHTTPD(ApacheWebserver)

Jacques

From: "Robert G." <ga...@mercon24.de>
> Hey guys, 
> 
> i have the following problem:
> 
> I use sometimes CMS to show content. The CMS hyperlink I modify with Apache
> mod rewrite like:
> 
> *user types in:* domain.tld/content/somecontent.html
> *apche mod rewrite sends to ofbiz:
> *domain.tld/ecommerce/control/cms/content/somecontent
> 
> It works, that I get shown the content, but I loose the session, so ofbiz
> creates a new cookie / session. When I directly type the correct ofbiz url,
> than the session is the same as before, and everything works fine.
> 
> Do anyone has an idea how I can fix it?
> 
> thanks in advance
> 
> 
> 
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Mod-Rewrite-and-Session-handling-tp4638721.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.