Welcome! Log In Create A New Profile

Advanced

Re: fastcgi_cache_bypass and 502 Bad Gateway

António P. P. Almeida
February 11, 2011 04:58PM
On 11 Fev 2011 16h57 WET, nginx-forum@nginx.us wrote:

> The point I was trying to make is that in this case for instance,
> ...
>
> [code]
> set $donot_cache 0;
> if ($http_cookie ~*
> "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {
> set $donot_cache 1;
> }
> set $test $donot_cache;
> [/code]
>
> ... $test will always be equal to 0 as any variable set within the
> 'if' block is not exposed outside the block AFAIK.
>
> So when you run ...
>
> [code]
> set $donot_cache 0;
> if ($http_cookie ~*
> "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {
> set $donot_cache 1;
> }


This is because as Maxim, and agentzh have explained before: an if is
an *implicit location*. So what you're requesting above is for a
variable with a value changed at a lower level (implicit location) be
visible at an upper level (containing location).

My understanding of Nginx scoping is that it works in one direction,
i.e., you can only be sure that this works global -> http -> server ->
location -> if in location.

There's no reverse path for inheriting variables set at a lower level
on a higher level.

Can someone more knowledgeable than I concur and straighten me if I'm
incorrect?

Thanks,
--- appa



...
> fastcgi_no_cache $donot_cache;
> [/code]
>
> ... '$donot_cache' will always resolve to null.
>
> Again, this is AFAIK based on stuff I have read here and there.
>
> See here for instance:
> http://forum.nginx.org/read.php?2,25197,25197#msg-25197
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,173795,174192#msg-174192
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx

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

fastcgi_cache_bypass and 502 Bad Gateway

kaspars February 10, 2011 07:08AM

Re: fastcgi_cache_bypass and 502 Bad Gateway

kaspars February 11, 2011 08:24AM

Re: fastcgi_cache_bypass and 502 Bad Gateway

Dayo February 11, 2011 10:15AM

Re: fastcgi_cache_bypass and 502 Bad Gateway

kaspars February 11, 2011 11:31AM

Re: fastcgi_cache_bypass and 502 Bad Gateway

Dayo February 11, 2011 11:57AM

Re: fastcgi_cache_bypass and 502 Bad Gateway

kaspars February 11, 2011 12:07PM

Re: fastcgi_cache_bypass and 502 Bad Gateway

Dayo February 11, 2011 12:50PM

Re: fastcgi_cache_bypass and 502 Bad Gateway

Maxim Dounin February 11, 2011 01:08PM

Re: fastcgi_cache_bypass and 502 Bad Gateway

kaspars February 11, 2011 04:19PM

Re: fastcgi_cache_bypass and 502 Bad Gateway

António P. P. Almeida February 11, 2011 04:58PM

Re: fastcgi_cache_bypass and 502 Bad Gateway

Maxim Dounin February 11, 2011 07:10PM

Re: fastcgi_cache_bypass and 502 Bad Gateway

António P. P. Almeida February 11, 2011 07:30PM

Re: fastcgi_cache_bypass and 502 Bad Gateway

Dayo February 12, 2011 04:15AM

Re: fastcgi_cache_bypass and 502 Bad Gateway

kaspars February 13, 2011 09:18AM

Re: fastcgi_cache_bypass and 502 Bad Gateway

António P. P. Almeida February 12, 2011 07:52AM

Re: fastcgi_cache_bypass and 502 Bad Gateway

agentzh February 13, 2011 11:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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