Recently I have migrated an application which was deployed in Apache Webserver to Nginx. After the migration, the application stopped working. On troubleshooting I found that some of the requests were getting cancelled because of missing headers.

We were using Google Single Sign-On in the application and Google passes some headers with underscore symbol. As per HTTP standards, headers with underscore are perfectly valid. But by default Nginx ignores the headers with underscore.

To enable Nginx to accept headers with underscore, we need to add the following parameter in the server block of Nginx configuration.

underscores_in_headers on;

After adding this configuration parameter, validate and reload the configuration by using the following command.

nginx -t

service nginx reload

This will solve the issue. I hope this tip is useful.