proxy_cache_valid depending on $host

Phil Endecott nginx_list at chezphil.org
Mon Jan 25 16:26:49 UTC 2021


Dear Experts,

I wanted to write this:

proxy_cache_valid 200 5m;
if ($host ~ foo) {
   proxy_cache_valid 200 30d;
}

but proxy_cache_valid is not allowed in "if" blocks.
Is there some work-around to have different cache validity times
for different hosts, in a caching proxy?


Thanks, Phil.






More information about the nginx mailing list