Welcome! Log In Create A New Profile

Advanced

Re: Issue with proxy_cache_key after rewrite

Maxim Dounin
December 24, 2010 10:52PM
Hello!

On Fri, Dec 24, 2010 at 11:57:30PM +0100, Sven 'Darkman' Michels wrote:

> 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...?

Default listed in wiki/docs isn't what actually used by default as
proxy_cache_key. In russian docs[1] you may find something like

By default value is similar to
proxy_cache_key $scheme$proxy_host$uri$is_args$args;

Word "similar" is key one. Actual value can't be expressed with
variables. It's something like $proxy_url - but there are no such
variable.

[1] http://sysoev.ru/nginx/docs/http/ngx_http_proxy_module.html#proxy_cache_key

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Issue with proxy_cache_key after rewrite

Sven 'Darkman' Michels December 24, 2010 06:02PM

Re: Issue with proxy_cache_key after rewrite

Piotr Sikora December 24, 2010 08:34PM

Re: Issue with proxy_cache_key after rewrite

Eugaia December 24, 2010 08:44PM

Re: Issue with proxy_cache_key after rewrite

Maxim Dounin December 24, 2010 10:52PM

Re: Issue with proxy_cache_key after rewrite

Sven 'Darkman' Michels December 25, 2010 08:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 165
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready