underscores_in_header is an Nginx configuration option that controls whether Nginx should ignore requests that use underscore characters as part of HTTP request headers. By default, Nginx does not allow the use of underscore characters in request headers.

The request header (key-value format) in the HTTP protocol needs to meet certain format requirements. The RFC2616 specification defines the Header Field syntax in the HTTP protocol and requires that the header field name cannot contain the underscore (_) character. The RFC developed in 2006 subsequently modified the specification to make the use of the underscore an optional feature and allow HTTP applications to use the previously prohibited _ character if it involved WEbDAV or some other specification.

If the server-side application requires the use of underscores in text or files as field names in request headers, you need to set underscores_in_header to on in the nginx configuration so that nginx supports underscores as much as possible.

This option can be set in the http, server or location section of the Nginx configuration file, for example:

http {
    underscores_in_headers on;
}