Cannot log a cookie with a dash in the name

Valentin V. Bartenev ne at vbart.ru
Mon Mar 12 20:57:17 UTC 2012


On Monday 12 March 2012 22:38:08 Hates_ wrote:
> I am trying to log cookies but they have a dash in the name as such:
> 
>     "Member-v1.0=$cookie_Member-v1.0"
> 
> My logs come through as:
> 
>     Member-v1.0=--v1.0
> 
> Is there a work around?
> 
> I've tried wrapping the name in curly brackets and also using
> underscores but get an error about an unmatched bracket or no value.
> I've tried the following formats:
> 
>     "Member-v1.0=${cookie_Member-v1.0}"
> 
>     "Member-v1.0=$cookie_Member_v1.0"
> 
>     "Member-v1.0=$cookie_Member_v1_0"
> 
> Any help would be greatly appreciated. I don't want to have to move to
> Apache :\
> 

The map module may help:

  map $http_cookie $member_cookie {
	default  NONE;
     ^Member-v1\.0=(?P<mc>[^;]+) $mc;
  }

http://wiki.nginx.org/HttpMapModule


 wbr, Valentin V. Bartenev



More information about the nginx mailing list