Max File Size Allowed In Cache

Maxim Dounin mdounin at mdounin.ru
Wed Oct 1 11:24:44 UTC 2014


Hello!

On Tue, Sep 30, 2014 at 11:38:59PM -0400, martinproinity wrote:

> Thanks Maxim. Is it possible the filter on a value "larger than" or "smaller
> than"? How would the regex in the map block look like? e.g. smaller than
> 1000000?
> 
> I tried something like this, which is not working:
> map $upstream_http_content_length $docache {
>         default         0;
>         "~*([1-9][0-9]{0,6}|1000)$" 1;
> }

You've forgot start anchor.  Something like this should work to 
disable cache for responses with Content-Length larger than 
1000000:

    map $upstream_http_content_length $nocache {
        default                       1;
        "~^[1-9]{0,6}$"               0;
    }

    proxy_no_cache $nocache;

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list