Antonio P.P. Almeida
December 10, 2012 09:10AM
> One interesting observation
>
> I put this code
>
> location /test {
> proxy_pass http://a/;
> ....
> set $dont_cache 1;
>
> if ( $cookie_route ) {
> set $dont_cache 0;
> }
> proxy_cache_bypass $dont_cache;
> proxy_no_cache $dont_cache;
>
> }
>
> and it started to dis-honour the trailing slash http://a/ With the end /
> it
> does not look for /test but only due to the if block it started to look
> for
> it.

You have to set it at the server level to make it work.

set $dont_cache 1;

if ($cookie_route) {
set $dont_cache 0;
}

location /test {
proxy_pass http://a/;
proxy_cache_bypass $dont_cache;
proxy_no_cache $dont_cache;
}

If creates an implicit location.

If is evil: http://wiki.nginx.org/IfIsEvil

As Igor said above use map and get clear of the if directive quirks.

--appa

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

proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 02:19AM

Re: proxy_cache_bypass and proxy_no_cache

António P. P. Almeida December 10, 2012 03:32AM

Re: proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 04:02AM

Re: proxy_cache_bypass and proxy_no_cache

Antonio P.P. Almeida December 10, 2012 04:28AM

Re: proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 04:31AM

Re: proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 05:15AM

Re: proxy_cache_bypass and proxy_no_cache

amodpandey December 10, 2012 05:22AM

Re: proxy_cache_bypass and proxy_no_cache

Igor Sysoev December 10, 2012 06:24AM

Re: proxy_cache_bypass and proxy_no_cache

Igor Sysoev December 10, 2012 06:26AM

Re: proxy_cache_bypass and proxy_no_cache

António P. P. Almeida December 10, 2012 03:56AM

Re: proxy_cache_bypass and proxy_no_cache

Antonio P.P. Almeida December 10, 2012 09:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 308
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