memcache key double escaped

Xavier Grangier grangier at
Thu Feb 26 09:33:41 MSK 2009

Hello all,

I have trouble with nginx memcached module with urls containing  
special char, for instance :

GET /list.xml?fulltext=testé&sort=rating&dir=DESC

will store the following key in memcache :

<25 set brh:262:68:/list.xml?fulltext=test%C3%A9&sort=rating&dir=DESC  
0 21600 7006

If I query back the same URL I have the following message in nginx  
debug log :

2009/02/26 07:16:38 [info] 14614#0: *4684 key: "brh:262:68:/list.xml? 
fulltext=test%25C3%25A9&sort=rating&dir=DESC" was not found by  
memcached while reading response header from upstream, client:, server:, request: "GET /list.xml? 
fulltext=test%C3%A9&sort=rating&dir=DESC HTTP/1.0", upstream:  
"memcached://", host: ""

The request matches the key, eq : fulltext=test%C3%A9
But the memcache module is double escaping will trying to get the  
query : fulltext=test%25C3%25A9

I don't know if this is the correct behaviour, of course this can be  
bypasse using the following code in python for exemple :


$memcached_key is set like this in nginx.conf :

set $memcached_key brh:$prefix:$request_uri;



More information about the nginx mailing list