Skipping the proxy cache based on a cookie?

António P. P. Almeida appa at perusio.net
Thu Jan 20 23:29:47 MSK 2011


On 20 Jan 2011 04h05 WET, agentzh at gmail.com wrote:

> On Wed, Jan 19, 2011 at 5:52 AM, António P. P. Almeida
> <appa at perusio.net> wrote:
>>>
>>> Any chance of implementing ...
>>> [code]
>>> proxy_cache_bypass_empty $cookie_COOKIE;
>>> proxy_no_cache_empty $cookie_COOKIE;
>>> [/code]
>>
>> If I understand your question, wouldn't this do the trick?
>>
>> if ($cookie_COOKIE = "") {
>>  set $cookie_no_cache true;
>> }
>>
>> Now it works as "usual".
>
> Nginx's "if" is evil and can be even more evil when you use it a bit
> more. The code snippet above can only work when being put into the
> "server" block rather than the "location" block :)

Ok. Care to elaborate on that? I think is something that should be
explicitly stated in the IfIsEvil wiki page.

Thanks,
--- appa



More information about the nginx mailing list