Issue with proxy_cache_key after rewrite

Piotr Sikora piotr.sikora at
Sat Dec 25 04:29:41 MSK 2010


> So i've added the following:
> proxy_cache_key "$scheme$host$request_uri";

Try using "$scheme$host$uri$is_args$args" ;)

> when i remove the proxy_cache_key from the config i get the following key:
> http://interal_host:internal_port/documents/test.pdf
> so something here seems to be "strange". Because the default key is:
> default: $scheme$proxy_host$request_uri;

No, default key isn't calculated from variables...
It's something like: "${proxy_scheme}://$proxy_host$uri$is_args$args"

Also, "$proxy_host" returns whatever you've got in your "proxy_pass" 
directive, so in case you've got "proxy_pass" it will 
return "".

> first: $scheme seems to be http when beeing used, but http:// when 
> default.

See above.

> second: the $request_uri is not rewritten when defined as key, but it 
> seems
> to be rewritten by default.

"$request_uri" isn't used in the default cache key.

Best regards,
Piotr Sikora < piotr.sikora at >

More information about the nginx mailing list