Issue with proxy_cache_key after rewrite

Sven 'Darkman' Michels sven at darkman.de
Sat Dec 25 01:57:30 MSK 2010


Hi,

i've run a few tests with the nginx proxy module. I would like to have
my content cached with the "$scheme$host$request_uri" key, like suggested
on the wiki page[1]. So i've added the following:
proxy_cache_key "$scheme$host$request_uri";

into the http {} block. After the test i've checked the keys which are used
in the cached files and noticed that the key was
httpmy_vhost/original_request_uri

but i've a perl module which does a internal_redirect which rewrites some
paths like /olddir/ to /.

Now we have the following request:
http//my_vhost/olddir/documents/test.pdf

so i thought the key should be
httpmy_vhost/documents/test.pdf

but it was
httpmy_vhost/olddir/documents/test.pdf

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;

and now we see the following differences:
first: $scheme seems to be http when beeing used, but http:// when default.
second: the $request_uri is not rewritten when defined as key, but it seems
to be rewritten by default.

Seems like a bug to me...?

Regards,
Sven



More information about the nginx mailing list