fastcgi_pass_request_body

The `fastcgi_pass_request_body` directive controls the forwarding of the request body to the FastCGI server.

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

Description

The fastcgi_pass_request_body directive is used within the NGINX configuration to specify whether the body of the client's HTTP request should be sent to the FastCGI server. This directive can take a flag as an argument, which can be either 'on' or 'off'. When set to 'on', the request body is forwarded to the backend FastCGI server as part of the request handling. Conversely, when set to 'off', the request body is not sent, effectively ignoring any data that may have been submitted by the client in the request body.

This directive is particularly useful in situations where the processing of the request does not require any input data from the body, such as GET requests or when using the FastCGI server for certain operations that do not handle input data. Proper usage ensures efficient data handling and response management between NGINX and the FastCGI backend, minimizing unnecessary data transfer when it's not needed. It is often combined with other FastCGI directives, such as fastcgi_pass to ensure that the appropriate server is being contacted based on the defined request contexts.

Config Example

location /example {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_pass_request_body off;
}

Make sure to set this directive according to whether the FastCGI application needs the request body; setting it to 'off' when it is needed will result in missing data.

Remember that this directive applies to requests handled through FastCGI only; using it within other contexts may not yield any effect.

← Back to all directives