Is there any way to limit the maximum size of an individual object in a
proxy cache? Looking through the documentation ( Module ngx_http_proxy_module ) I’m not
seeing
anything directly related to that.
I might be misunderstanding the proxy_temp_file_write_size or
proxy_max_temp_file_size commands, but outside of limiting the entire
cache
size with proxy_cache_path, I’m not seeing anything that says “this is
the
maximum size of an individual file that can sit in cache”.
On Tue, Sep 30, 2014 at 01:35:30AM -0400, martinproinity wrote:
would be interesting to know the answer to this questions as I was wondering
as well if that is possible.
As of now there is no easy way to limit caching based on a
response size. In simple cases, when the Content-Length header is
present in a response, the proxy_no_cache combined with a map (or
embedded perl, or whatever) can be used to disable caching based
on the Content-Length header returned.
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:
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;
}
Posted at Nginx Forum:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.