Hi,
For a given location, I want the requests to be cached only if a
particular
cookie is not present. How do I achieve that with nginx?
Currently I’m trying following config
Here, if the logintoken cookie is not present in the request, the
cache_key
variable is set to a valid key string. If the cookie is present,
cache_key
it will be undefined. So I expect the proxy_cache_key directive to not
cache
that request. But it seems it still caches the request with empty key.
Is
this the expected behavior? Is there any solution this problem?
Also, with “proxy_cache_valid 200 5m;” I expect only 200 responses to be
cached. But I’m seeing 30x responses also getting cached.
Hi,
For a given location, I want the requests to be cached only if a particular cookie is not present. How do I achieve that with nginx?
Currently I’m trying following config
location /album {
if ($cookie_logintoken ~* “”) {
set $cache_key $scheme$proxy_host$uri$is_args$args;
}
Could you please elaborate on it? There was no issues with $cache_key
value
being set in if block and being visible to proxy_cache_key directive.
The
issue is when the if condition is not satisfied and hence the $cache_key
is
not set, I was expecting the caching to get disabled altogether as
proxy_cache_key was now being passed a uninitialized variable as
parameter.
Thanks,
Vinay
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.