You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jarecsni János <ja...@mhc.hu> on 2002/02/15 11:45:35 UTC

setting the path in the session cookie (Tomcat 402b)

Hi,

it seems that tomcat uses the "/contextname" path when creating the cookie
for the JSESSIONID. Since we use Apache in front of Tomcat and we use
mod_rewrite with mod_proxy to provide aliasing of dynamic Java resources, it
is not working for us.

We would like to be able to configure this path.

Thanks in advance
János

--
Jarecsni, János
MORGAN HILL CONSULTING, Internet Applications Unit
mailto:Jarecsni.Janos@morganhillconsulting.hu
http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: setting the path in the session cookie (Tomcat 402b)

Posted by Jarecsni János <ja...@mhc.hu>.
Hi, Jean-Frederic,

one more addition:

This works fine:

	RewriteRule ^/istore/something(.*) http://mydomain/istore$1 [P]

Cookies work to (because the "/istore" will be present in both the original
and the proxied url). You can then use:
http://mydomain/istore/something/aServlet (which eventually will end at
http://mydomain/istore/aServlet


I want this to work:

    RewriteRule !^/istore(.*) - [C]
    RewriteRule (.*) http://mydomain/istore$1 [P]

So any URL not containing the "/istore" prefix should be rewritten by
prepending "/istore". Then you can use URLs like: http://mydomain/anything.
This is what you normally do with Apache-served sites. I don't want to see
no application context in my urls basically.

Hope you get what I try to express!

Cheers,
János (=Jean in Hungarian :)

--
Jarecsni, János
MORGAN HILL CONSULTING, Internet Applications Unit
mailto:Jarecsni.Janos@morganhillconsulting.hu
http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392

|-----Original Message-----
|From: jfclere@vtxrm2.bcn.fsc.net [mailto:jfclere@vtxrm2.bcn.fsc.net]On
|Behalf Of jean-frederic clere
|Sent: Friday, February 15, 2002 12:51 PM
|To: Tomcat Developers List
|Subject: Re: setting the path in the session cookie (Tomcat 402b)
|
|
|Jarecsni János wrote:
|>
|> Hi,
|>
|> well a short explanation follows then.
|>
|> Since we want to alias our dynamic resources (which are to be served by
|> Tomcat+JBoss) in Apache we have to use mod_rewrite and mod_proxy.
|
|Why are you not using mod_jk or mod_webapp?
|
|> We need
|> the proxy because the rewritten urls don't get sent to tomcat,
|Apache treats
|> them as files. If we proxy those rewritten urls back to the same virtual
|> host, they get sent to tomcat.
|>
|> The only problem is that the webcontext is hardwired in the
|session cookie
|> by Tomcat. And since the webcontext must be rewritten for the
|whole thing to
|> work too, session cookies don't work anymore (the client doesn't
|send them
|> back because of the different path).
|>
|> The Sun RI sets the session cookie path to "/". That would work in our
|> situation too.
|>
|> Can I hope some sort of a remedy of this problem in a short time, what do
|> you think?
|>
|> Cheers & thanks.
|> János
|>
|> --
|> Jarecsni, János
|> MORGAN HILL CONSULTING, Internet Applications Unit
|> mailto:Jarecsni.Janos@morganhillconsulting.hu
|> http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392
|>
|> |-----Original Message-----
|> |From: jfclere@vtxrm2.bcn.fsc.net [mailto:jfclere@vtxrm2.bcn.fsc.net]On
|> |Behalf Of jean-frederic clere
|> |Sent: Friday, February 15, 2002 12:16 PM
|> |To: Tomcat Developers List
|> |Subject: Re: setting the path in the session cookie (Tomcat 402b)
|> |
|> |
|> |Jarecsni János wrote:
|> |>
|> |> Hi,
|> |>
|> |> it seems that tomcat uses the "/contextname" path when creating
|> |the cookie
|> |> for the JSESSIONID. Since we use Apache in front of Tomcat and we use
|> |> mod_rewrite with mod_proxy to provide aliasing of dynamic Java
|> |resources, it
|> |> is not working for us.
|> |
|> |You should explain a little more why you have to that (like you
|> |have done it in
|> |httpd-dev list).
|> |
|> |>
|> |> We would like to be able to configure this path.
|> |>
|> |> Thanks in advance
|> |> János
|> |>
|> |> --
|> |> Jarecsni, János
|> |> MORGAN HILL CONSULTING, Internet Applications Unit
|> |> mailto:Jarecsni.Janos@morganhillconsulting.hu
|> |> http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392
|> |>
|> |> --
|> |> To unsubscribe, e-mail:
|> |<ma...@jakarta.apache.org>
|> |> For
|> |additional commands, e-mail: <ma...@jakarta.apache.org>
|> |
|> |--
|> |To unsubscribe, e-mail:
|> |<ma...@jakarta.apache.org>
|> |For additional
|> |commands, e-mail: <ma...@jakarta.apache.org>
|> |
|> |
|>
|> --
|> To unsubscribe, e-mail:
|<ma...@jakarta.apache.org>
|> For
|additional commands, e-mail: <ma...@jakarta.apache.org>
|
|--
|To unsubscribe, e-mail:
|<ma...@jakarta.apache.org>
|For additional
|commands, e-mail: <ma...@jakarta.apache.org>
|
|


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: setting the path in the session cookie (Tomcat 402b)

Posted by Jarecsni János <ja...@mhc.hu>.
Hi Jean-Frederic,

I definitely use it! :) I use mod_jk. I have the appropriate JkMount
settings included in httpd.conf. Everything works fine. It is the _aliasing_
that cannot be done.

so I can do
http://apache.virtual.host/jbossapplicationcontext/something?someparameter

what I cannot do is:

http://apache.virtual.host/somethingelse

As I've told before, rewriting works fine in Apache, except that a rewritten
request does not get passed to Tomcat (no matter mod_jk is there and
working). That's why I use another round: I proxy the request (the rewritten
one) to the same vhost again. And as you expect it, it finally gets to
tomcat. Is that clear?

The only problem now is the session cookie. Tomcat hardwires the app
context. And that's what doesn't work with proxying. So: I need to be able
to define what path to set the session cookie to.

That's all there is to it :)

Cheers,
János


--
Jarecsni, János
MORGAN HILL CONSULTING, Internet Applications Unit
mailto:Jarecsni.Janos@morganhillconsulting.hu
http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392

|
|Why are you not using mod_jk or mod_webapp?
|


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: setting the path in the session cookie (Tomcat 402b)

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Jarecsni János wrote:
> 
> Hi,
> 
> well a short explanation follows then.
> 
> Since we want to alias our dynamic resources (which are to be served by
> Tomcat+JBoss) in Apache we have to use mod_rewrite and mod_proxy.

Why are you not using mod_jk or mod_webapp?

> We need
> the proxy because the rewritten urls don't get sent to tomcat, Apache treats
> them as files. If we proxy those rewritten urls back to the same virtual
> host, they get sent to tomcat.
> 
> The only problem is that the webcontext is hardwired in the session cookie
> by Tomcat. And since the webcontext must be rewritten for the whole thing to
> work too, session cookies don't work anymore (the client doesn't send them
> back because of the different path).
> 
> The Sun RI sets the session cookie path to "/". That would work in our
> situation too.
> 
> Can I hope some sort of a remedy of this problem in a short time, what do
> you think?
> 
> Cheers & thanks.
> János
> 
> --
> Jarecsni, János
> MORGAN HILL CONSULTING, Internet Applications Unit
> mailto:Jarecsni.Janos@morganhillconsulting.hu
> http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392
> 
> |-----Original Message-----
> |From: jfclere@vtxrm2.bcn.fsc.net [mailto:jfclere@vtxrm2.bcn.fsc.net]On
> |Behalf Of jean-frederic clere
> |Sent: Friday, February 15, 2002 12:16 PM
> |To: Tomcat Developers List
> |Subject: Re: setting the path in the session cookie (Tomcat 402b)
> |
> |
> |Jarecsni János wrote:
> |>
> |> Hi,
> |>
> |> it seems that tomcat uses the "/contextname" path when creating
> |the cookie
> |> for the JSESSIONID. Since we use Apache in front of Tomcat and we use
> |> mod_rewrite with mod_proxy to provide aliasing of dynamic Java
> |resources, it
> |> is not working for us.
> |
> |You should explain a little more why you have to that (like you
> |have done it in
> |httpd-dev list).
> |
> |>
> |> We would like to be able to configure this path.
> |>
> |> Thanks in advance
> |> János
> |>
> |> --
> |> Jarecsni, János
> |> MORGAN HILL CONSULTING, Internet Applications Unit
> |> mailto:Jarecsni.Janos@morganhillconsulting.hu
> |> http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392
> |>
> |> --
> |> To unsubscribe, e-mail:
> |<ma...@jakarta.apache.org>
> |> For
> |additional commands, e-mail: <ma...@jakarta.apache.org>
> |
> |--
> |To unsubscribe, e-mail:
> |<ma...@jakarta.apache.org>
> |For additional
> |commands, e-mail: <ma...@jakarta.apache.org>
> |
> |
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: setting the path in the session cookie (Tomcat 402b)

Posted by Jarecsni János <ja...@mhc.hu>.
Hi,

well a short explanation follows then.

Since we want to alias our dynamic resources (which are to be served by
Tomcat+JBoss) in Apache we have to use mod_rewrite and mod_proxy. We need
the proxy because the rewritten urls don't get sent to tomcat, Apache treats
them as files. If we proxy those rewritten urls back to the same virtual
host, they get sent to tomcat.

The only problem is that the webcontext is hardwired in the session cookie
by Tomcat. And since the webcontext must be rewritten for the whole thing to
work too, session cookies don't work anymore (the client doesn't send them
back because of the different path).

The Sun RI sets the session cookie path to "/". That would work in our
situation too.

Can I hope some sort of a remedy of this problem in a short time, what do
you think?

Cheers & thanks.
János


--
Jarecsni, János
MORGAN HILL CONSULTING, Internet Applications Unit
mailto:Jarecsni.Janos@morganhillconsulting.hu
http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392

|-----Original Message-----
|From: jfclere@vtxrm2.bcn.fsc.net [mailto:jfclere@vtxrm2.bcn.fsc.net]On
|Behalf Of jean-frederic clere
|Sent: Friday, February 15, 2002 12:16 PM
|To: Tomcat Developers List
|Subject: Re: setting the path in the session cookie (Tomcat 402b)
|
|
|Jarecsni János wrote:
|>
|> Hi,
|>
|> it seems that tomcat uses the "/contextname" path when creating
|the cookie
|> for the JSESSIONID. Since we use Apache in front of Tomcat and we use
|> mod_rewrite with mod_proxy to provide aliasing of dynamic Java
|resources, it
|> is not working for us.
|
|You should explain a little more why you have to that (like you
|have done it in
|httpd-dev list).
|
|>
|> We would like to be able to configure this path.
|>
|> Thanks in advance
|> János
|>
|> --
|> Jarecsni, János
|> MORGAN HILL CONSULTING, Internet Applications Unit
|> mailto:Jarecsni.Janos@morganhillconsulting.hu
|> http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392
|>
|> --
|> To unsubscribe, e-mail:
|<ma...@jakarta.apache.org>
|> For
|additional commands, e-mail: <ma...@jakarta.apache.org>
|
|--
|To unsubscribe, e-mail:
|<ma...@jakarta.apache.org>
|For additional
|commands, e-mail: <ma...@jakarta.apache.org>
|
|


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: setting the path in the session cookie (Tomcat 402b)

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Jarecsni János wrote:
> 
> Hi,
> 
> it seems that tomcat uses the "/contextname" path when creating the cookie
> for the JSESSIONID. Since we use Apache in front of Tomcat and we use
> mod_rewrite with mod_proxy to provide aliasing of dynamic Java resources, it
> is not working for us.

You should explain a little more why you have to that (like you have done it in
httpd-dev list).

> 
> We would like to be able to configure this path.
> 
> Thanks in advance
> János
> 
> --
> Jarecsni, János
> MORGAN HILL CONSULTING, Internet Applications Unit
> mailto:Jarecsni.Janos@morganhillconsulting.hu
> http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>