Hi,
I have two questions regarding the use of cookies in Apache RewriteRules:
I want to build a specific URL depending on the content of a cookie.
This is how I get my cookie:
Code:
RewriteCond %{HTTP:Cookie} !aCookie=set
RewriteCond %{REQUEST_URI} ^/(.*)/mail/
RewriteRule /(.*)/mail/ - [CO=ServerName:$1:.acme.com,CO=aCookie:set:.acme.com]
This works and I get the server name depending on the URL pattern in my cookie ServerName. This cookie is then used during the whole session.
Now I'd like to:
1. check wether the cookie is set (without knowing its content). I was not able to achieve that until now and actually set a second cookie (aCookie in my example above) and check for its content as a first condition. Does the first line of my example below achieve that? I couldn't verify that until now...
2. use the content of the cookie ServerName to build subsequent URLs
I thought, that I could build something like:
Code:
RewriteCond %{HTTP:Cookie} !ServerName= # does this check for the existence of the cookie????
RewriteCond %{REQUEST_URI} ^/
RewriteRule /(.*) http://<Content of saved cookie>.acme.com/$1 [P]
But could not find any hint on how to achieve that until now.
Any hints would be greatly appreciated.
Thx, Marc
My question is related to Apache 2.4 as reverse proxy on ubuntu 12.04.1
Recent comments
16 hours 47 min ago
17 hours 47 min ago
21 hours 33 min ago
22 hours 48 min ago
1 day 2 hours ago
1 day 9 hours ago
1 day 18 hours ago
1 day 20 hours ago
2 days 11 hours ago
2 days 13 hours ago