Hi. I have a problem with a JEE app deployed on Tomcat: it needs to share the same session across different subdomains, but Tomcat (according to the specs, I think) doesn't explicitly set a multi-subdomain cookie to track the session.

I've found some people with the same problem that uses a Tomcat valve to overcome this problem, yet it doesn't seem to work in 100% of cases. The code that controls the cookie data doesn't seem to be extensible, so I'm trying to use Apache (linked to Tomcat with mod_proxy) to add the correct domain to the cookie sent by Tomcat.

The cookie originally sent by Tomcat looks like this:

Set-Cookie: JSESSIONID=A2642645DC66D29552C87886DBA3CFE4; Path=/contextpath

And I need it to look like this:

Set-Cookie: JSESSIONID=A2642645DC66D29552C87886DBA3CFE4; Path=/contextpath; Domain=.my.domain

At first, I thought that with a combination of mod_headers and mod_setenvif this could be done, with something like this:

SetEnvIf Set-Cookie ^(JSESSIONID=.*)$ jsessionid_value=$1
Header set Set-Cookie "%{jsessionid_value}e; Domain=.my.domain" env=jsessionid_value

But SetEnvIf doesn't seem to support conditionally setting environment variables depending on response headers, just the request ones. And I don't know if it allows the use of capturing groups and backreferences, since the documentation doesn't mention it.

Any other alternative before giving up and modifying some of Tomcat classes?

thanks in advance
**

* ***

****

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
  "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to