fastcgi_ignore_client_abort
The fastcgi_ignore_client_abort directive controls whether NGINX should ignore client disconnection when processing FastCGI requests.
Description
The fastcgi_ignore_client_abort directive is a configuration option in NGINX that helps manage the behavior of requests processed via the FastCGI interface. When enabled (set to 'on'), NGINX will continue processing the response from the backend FastCGI server even if the client that made the request disconnects before the response is fully sent. Conversely, if this directive is set to 'off', NGINX will terminate the FastCGI request when the client disconnects, which can be essential in certain use cases where resource conservation is a priority. It provides control over how resources are utilized in scenarios where the client might abandon the request, potentially allowing ongoing backend processing costs to be reduced.
It is important to note that if you have long-running FastCGI requests that are expected to complete even after a client disconnects, enabling this directive can be beneficial. However, in scenarios where the response is dynamically generated and relevant to the client's session, keeping the default (off) may be prudent to avoid unnecessary processing and resource allocation. This directive can be set in the http, server, or location contexts, affecting where client disconnect behavior is governed.
Config Example
location /api {
fastcgi_pass 127.0.0.1:9000;
fastcgi_ignore_client_abort on;
}Setting this directive to 'on' can lead to resource waste if a client disconnects, as NGINX will continue processing requests that might no longer be relevant.
Make sure to carefully assess when to use 'on', as it could have implications for performance especially under heavy load.