uwsgi_force_ranges

The `uwsgi_force_ranges` directive enables the server to respond to range requests for uWSGI applications by returning the full response when set to on.

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

Description

The uwsgi_force_ranges directive is a configuration option in NGINX that affects how range requests are handled for uWSGI applications. When this directive is enabled (set to 'on'), NGINX will ignore any range requests received for the associated server or location block, responding with the full resource instead of a partial response. This behavior can be particularly useful in scenarios where serving partial content may lead to complications in application logic or client expectations.

Specifically, this directive is applied in the context of HTTP, server, and location blocks, allowing for flexible configuration. When enabled, it modifies the response generation process. In typical usage, a range request might instruct the server to deliver only a specific byte range of a resource. However, with uwsgi_force_ranges set to 'on', NGINX will instead process the request in such a way that the entirety of the resource is sent to the client, simplifying the handling of requests and possibly avoiding unintended behavior in applications designed to receive complete content.

The directive takes a flag as its argument. Using a value of 'on' activates the behavior, whereas setting it to 'off' (or its absence, as this directive defaults to 'off') allows the standard handling of range requests to take place.

Config Example

location /myapp {
    include uwsgi_params;
    uwsgi_pass myapp;
    uwsgi_force_ranges on;
}

Make sure that the underlying uWSGI application is compatible with receiving full responses; otherwise, this can lead to performance issues or increased load times.

If set to 'on', clients expecting partial content through range requests will receive the full resource instead, which may lead to unexpected behavior on the client side.

← Back to all directives