uwsgi_pass_request_headers

The 'uwsgi_pass_request_headers' directive controls the passing of request headers to the uWSGI server.

Syntaxuwsgi_pass_request_headers on | off;
Defaulton
Contexthttp, server, location
Argumentsflag

Description

The 'uwsgi_pass_request_headers' directive specifies whether to pass the incoming request headers to the uWSGI backend. This is a flag directive that accepts either 'on' or 'off'. When set to 'on', all headers from the incoming request are forwarded to the uWSGI server, which can be crucial for maintaining information about the original HTTP request when it processes the request further. If set to 'off', the headers are not sent to the backend, which may be suitable in situations where you want to minimize the data sent or if the backend does not require these headers.

Using this directive in the correct context (http, server, or location) is essential for its proper operation. It helps control the behavior of the uWSGI requests in a potentially resource-sensitive environment, allowing for efficient management of data being transmitted. The mode of operation can greatly affect application behavior, especially when dealing with variables like authentication and session management that may be tied to specific headers.

Config Example

location /app {
    uwsgi_pass 127.0.0.1:9000;
    uwsgi_pass_request_headers on;
}

Ensure that your uWSGI application is configured to handle the headers if you choose to pass them.

Setting this directive to 'off' could result in missing crucial information for some applications that rely on headers for processing.

← Back to all directives