9 messages in ru.sysoev.nginxRe: Rewrite url based on cookie
FromSent OnAttachments
Jason BJan 23, 2007 10:04 pm 
Igor SysoevJan 23, 2007 10:21 pm 
Jason BJan 23, 2007 10:42 pm 
Jonathan VanascoJan 24, 2007 12:08 am 
Igor SysoevJan 24, 2007 12:20 am 
Jonathan VanascoJan 24, 2007 12:51 am 
Ian EvansJan 26, 2007 2:11 am 
Igor SysoevJan 26, 2007 4:17 am 
Ian EvansJan 26, 2007 8:35 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Rewrite url based on cookieActions...
From:Jason B (jasj@public.gmane.org)
Date:Jan 23, 2007 10:42:47 pm
List:ru.sysoev.nginx

On 24/01/2007, at 5:21 PM, Igor Sysoev wrote:

On Wed, 24 Jan 2007, Jason B wrote:

Is it possible to rewrite a url based on a cookie value?

In apache it might look like this:

RewriteRule ^index.html$ index%{HTTP_COOKIE['cookieName']}.html

your case:

location = /index.html { set $name "";

if ($http_cookie ~ "cookieName=([^;]+)(?:;|$)") { set $name $1; }

index index$name.html; }

or more generic:

location / { set $name "";

if ($http_cookie ~ "cookieName=([^;]+)(?:;|$)") { set $name $1; }

index index$name.html; }

Excellent! :) Thanks Igor