httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego Manilla Suárez <>
Subject [users@httpd] Modify response header
Date Wed, 29 Apr 2009 10:31:59 GMT
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; 

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;" 

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:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message