views:

23

answers:

1

I have a page that issues an HTTP redirect. I need to append the current session id (jsessionid) to the end of the HTTP redirect to pass this id as a GET parameter in the redirect.

Can mod_header's Header append directive pick up a cookie value via SetEnvIf?

Should a rewrite rather be involved? But mod_rewrite just rewrites the request not the response, yes?

How would you solve this from an Apache perspective without touching back-end code?


Update: the Apache-JVM is handled by either mod_jk OR via IBM HTTP Server connection to WebSphere.

+1  A: 

As to my knowledge, with Apache HTTPd you do it like this:

SetEnvIf Cookie "mycookie=([^;]+)" MYCOOKIE=$1
SetEnvIf Cookie "mycookie=([^;]+)" HAVE_MYCOOKIE=1
Header add Set-Cookie "mycookie=%{MYCOOKIE}e; expires=0" env=HAVE_MYCOOKIE

You can also add additional cookie attributes like path and domain if you want.

Janoszen