proxy_cache_max_range_offset

The 'proxy_cache_max_range_offset' directive sets the maximum allowed range offset for proxied cached responses in NGINX.

Syntaxproxy_cache_max_range_offset size;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The 'proxy_cache_max_range_offset' directive is utilized within the contexts of http, server, and location blocks of an NGINX configuration. It is designed to specify the maximum range offset that can be accepted for a response that is served from the proxy cache. By default, NGINX will allow any range request that does not exceed this specified offset value, which effectively helps optimize the caching mechanism when dealing with byte ranges in large media files or other content.

Config Example

http {
    proxy_cache_path /tmp/cache levels=1:2 keys_zone=my_cache:10m max_size=1g;
    server {
        location /media {
            proxy_pass http://backend;
            proxy_cache my_cache;
            proxy_cache_max_range_offset 1048576;  # 1 MB
        }
    }
}

Ensure the value specified is appropriate for the content being served; too high a value may lead to excessive memory usage for large media files.

This directive only applies if the content is served from the proxy cache; enabling proxy caching is a prerequisite.

← Back to all directives