scgi_intercept_errors

The `scgi_intercept_errors` directive enables NGINX to intercept errors generated by SCGI servers, allowing custom error handling.

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

Description

The scgi_intercept_errors directive determines whether NGINX should intercept the error responses returned by SCGI servers when processing client requests. When set to 'on', it allows NGINX to handle the errors internally and respond with an appropriate error page or custom error handling logic as defined by other related directives like error_page.

In terms of behavior, setting this directive to 'off' will allow NGINX to pass the error responses directly back to the client without modification. This is particularly useful in scenarios where you want to return raw error messages from the SCGI application, such as in debug environments. Conversely, enabling it can enhance the user experience by providing more user-friendly error messages and ensuring that specific error codes trigger designated error responses as configured in the NGINX server blocks. This directive works in conjunction with the SCGI handling configuration, and its importance lies in controlling the flow of error information from back-end applications to clients.

Config Example

location /scgi {
    include scgi_params;
    scgi_pass 127.0.0.1:9000;
    scgi_intercept_errors on;
    error_page 404 /404.html;
}

Ensure you have defined error_page directives to handle the errors when this directive is set to 'on'.

Misconfiguring related error_page directives may lead to unexpected results when intercepting errors.

← Back to all directives