scgi_force_ranges

The `scgi_force_ranges` directive forces the use of range requests for SCGI responses, impacting how data is sent to clients.

Syntaxscgi_force_ranges on | off;
Defaultoff
Contexthttp, server, location
Argumentsflag

Description

The scgi_force_ranges directive in NGINX is used within the SCGI module to specify how requests for partial content should be handled. By enabling this directive (when set to 'on'), NGINX will respond to client requests for specific byte ranges in SCGI responses, adhering to the HTTP/1.1 specification for range requests. This is particularly useful for streaming scenarios where clients may need to retrieve only a portion of a file without downloading it entirely.

When scgi_force_ranges is set to 'on', the server will inspect the client request for a Range header and will attempt to parse the indicated byte ranges. This behavior may be useful for media files, large documents, or any scenario where responding with the entire content is unnecessary or inefficient. If the directive is set to 'off', NGINX will not honor the Range requests made by clients, serving them the full content instead.

The directive can be placed in various contexts such as http, server, or location, allowing for flexible configuration depending on the desired scope of partial content delivery. However, it's essential to ensure that the upstream SCGI application also supports range requests, or clients may experience unexpected behavior if ranges are requested but not processed correctly by the upstream server.

Config Example

location /example {
    scgi_pass 127.0.0.1:9000;
    scgi_force_ranges on;
}

Ensure your SCGI application supports range requests; otherwise, this directive has no effect.

Remember that some clients may behave unexpectedly if they request ranges but the server doesn't handle them properly.

← Back to all directives