Score:1

different proxy_cache_min_use value for different status codes

in flag

Is there a way we can proxy cache 404 errors after 3 numbers and all other responses immediately?

As you can see, we can use proxy_cache_valid for different status code

proxy_cache_valid 200 302 10m;
proxy_cache_valid 404      1m;

Like the above, I also want to use proxy_cache_min_uses for different status codes with different values.

Edit:

I have only one location

location /
{
....
proxy_cache_valid 200 302 3600m;
proxy_cache_valid 404      60m;
proxy_cache_min_uses 3;
....
}

In the above example, all the status codes will be cached only after 3 usages. Where as I want only 404 to be cached after 3 usages and all other status code immediately.

djdomi avatar
za flag
Please be more specific what you want to solve with an example because `proxy_cache_min_uses number; Default: proxy_cache_min_uses 1; Context: http, server, location` it vary on where you want to use it
Siddharth R avatar
in flag
I understand the syntax of proxy_cache_min_uses is proxy_cache_min_uses number. But I want to have two different proxy_cache_min_uses for different status codes but on the same locaiton.
djdomi avatar
za flag
it might be possible in if then else but if is evil on nginx
Siddharth R avatar
in flag
it is not possible to use proxy_cache_min_uses with in the if else, any idea how to get it done?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.