You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Jann Forrer <ja...@id.unizh.ch> on 2004/06/29 15:38:55 UTC
Lenya with mod_rewrite: change Cookie path
Hi
We have a apache with mod_rewrite as our frontend server in order to have
(among other things) URL's like:
http://www.oursite.ch/index.html
instead of
http://www.oursite.ch:8080/lenya/publication-name/live/index.html
We use tomcat as the servlet engine.
We have the problem that the Cookie path for the Cocoon session is the
name of the webapp in our case /lenya. Now the following happens if you
have e.g. restriced access to a live site i.e.
http://www.oursite.ch/index/ac.html
Each time you try to access this site you get the login screen and a new
cookie is set in the browser. The reason is that the browser did not sent
the cookie with the path lenya to a request whichout lenya in the URL.
All is fine if you have URL' like
http://www.oursite.ch/lenya/index/ac.html
This behaviour is also mentioned in
http://cocoon.apache.org/2.1/faq/faq-configure-environment.html#faq-N10086
However the solution described there is not very obvious to me. Has
someone else meet this problem and probably solved it? There are some
information about this problem on the net but I found no
satisfying solution :-(
Jann
---------------------------------------------------------------
Jann Forrer
Informatikdienste
Universität Zürich
Winterthurerstr. 190
CH-8057 Zuerich
oooO mail: jann.forrer@id.unizh.ch
( ) phone: +41 1 63 56772
\ ( fax: +41 1 63 54505
\_) http://www.id.unizh.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org
Re: Lenya with mod_rewrite: change Cookie path
Posted by Jann Forrer <ja...@id.unizh.ch>.
On Tue, 29 Jun 2004, Wolfgang Kaltz wrote:
> Jann Forrer <jann.forrer <at> id.unizh.ch> writes:
>
> > This behaviour is also mentioned in
> >
> > http://cocoon.apache.org/2.1/faq/faq-configure-environment.html#faq-N10086
> >
> > However the solution described there is not very obvious to me. Has
> > someone else meet this problem and probably solved it? There are some
> > information about this problem on the net but I found no
> > satisfying solution
>
> Hoi Jann,
> I agree, this information is not very satisfactory - if we find a definite
> answer, we should try to update it.
>
Yes that would be nice.
> Have you tried mod_proxy ? I have that working for another Cocoon-based
> application, which also uses Cookies for session handling
> (not Lenya yet, we are still developing a new site)
>
I also work with mod_proxy (together with mod_rewrite). Here is an extract
of my setting:
RewriteRule ^/cms/(.*) http://idcmslive01.unizh.ch:8080/lenya/sandbox/live/$1 [P]
ProxyPassReverse / http://idcmslive01.unizh.ch:8080/
Note that lenya is the context path. With that settings eacht time i
access a site i.e. http://foo.bar.com/cms/index.html a new cookie is set
because the browser did not sent the cookie. As I wrote in the last mail
this is because the browsers contains the context path (i.e. lenya). I
could change the context path of the webapp to "cms" in tomcats
server.xml but that is no lasting solution.
> I use the settings
> ProxyPass /foo/ http://localhost:8080/foo/
> ProxyPassReverse / http://localhost:8080/
>
Is "foo" the name of your webapp. In that case it would also work
for me. The setting above work without any problem if I write:
RewriteRule ^/lenya/(.*) http://idcmslive01.unizh.ch:8080/lenya/sandbox/live/$1 [P]
ProxyPassReverse / http://idcmslive01.unizh.ch:8080/
> I found this example on
> http://jetty.mortbay.org/jetty/faq?s=200-General&t=apache
> and am actually using it with Apache and Tomcat.
> I think the ProxyPassReverse instruction is necessary for the cookie stuff,
> although it does not say so explicitly.
>
Thank for the link.
BTW the host name informations of the cookie is ok. If you take the
example above it is foo.bar.com.
Regrads Jann
---------------------------------------------------------------
Jann Forrer
Informatikdienste
Universität Zürich
Winterthurerstr. 190
CH-8057 Zuerich
oooO mail: jann.forrer@id.unizh.ch
( ) phone: +41 1 63 56772
\ ( fax: +41 1 63 54505
\_) http://www.id.unizh.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org
Re: Lenya with mod_rewrite: change Cookie path
Posted by Wolfgang Kaltz <jw...@yahoo.com>.
Jann Forrer <jann.forrer <at> id.unizh.ch> writes:
> This behaviour is also mentioned in
>
> http://cocoon.apache.org/2.1/faq/faq-configure-environment.html#faq-N10086
>
> However the solution described there is not very obvious to me. Has
> someone else meet this problem and probably solved it? There are some
> information about this problem on the net but I found no
> satisfying solution
Hoi Jann,
I agree, this information is not very satisfactory - if we find a definite
answer, we should try to update it.
Have you tried mod_proxy ? I have that working for another Cocoon-based
application, which also uses Cookies for session handling
(not Lenya yet, we are still developing a new site)
I use the settings
ProxyPass /foo/ http://localhost:8080/foo/
ProxyPassReverse / http://localhost:8080/
I found this example on
http://jetty.mortbay.org/jetty/faq?s=200-General&t=apache
and am actually using it with Apache and Tomcat.
I think the ProxyPassReverse instruction is necessary for the cookie stuff,
although it does not say so explicitly.
The complete info on mod_proxy is at
http://httpd.apache.org/docs-2.0/mod/mod_proxy.html
I noticed in particular that the ProxyPreserveHost setting is necessary,
if you wish that Tomcat knows the name of the originating host. However,
I have found that using this directive, I lose the SSL connection towards
the outside world, so I'm leaving it off, and sessions still work.
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-user-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-user-help@cocoon.apache.org