scgi_pass_request_headers

The 'scgi_pass_request_headers' directive controls whether NGINX forwards SCGI request headers to the backend.

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

Description

The 'scgi_pass_request_headers' directive is used within the NGINX SCGI module to determine if request header information from the client's request should be passed along to the SCGI backend server. When this directive is enabled (set to 'on'), NGINX will relay the headers to the backend, which may be necessary for frameworks or applications relying on those headers for processing. Conversely, if set to 'off', NGINX will not send any request headers to the backend, which might be useful for optimizing performance in cases where headers are not needed.

This directive can be used in multiple contexts including 'http', 'server', and 'location'. By default, the directive is set to 'off'. Therefore, unless explicitly stated by the administrator, headers will not be passed to the backend SCGI server, which could lead to unexpected behaviors if those headers are essential for the application being served. Consequently, careful consideration is required when configuring this directive to ensure that the necessary headers are indeed forwarded, particularly for applications that depend on authentication or specific client data.

Config Example

location /scgi {
    scgi_pass your_backend;
    scgi_pass_request_headers on;
}

Forgetting to enable this directive when your backend application requires specific headers.

Using this directive within the wrong context such as 'if' conditions can lead to unexpected results. Make sure you place it inside 'http', 'server', or 'location' blocks. Before using it, ensure that the SCGI backend is correctly configured to handle the forwarded headers.

← Back to all directives