Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get headers with an underscore on NGINX

Tags:

php

nginx

php-5.5

I have multiple apps in Google Play and App Store. These send custom request headers but these headers include an underscore e.g api_key.

The server has now moved from PHP 5.2 on Apache to PHP 5.5 on nginx. On NGINX, apache_request_headers() and getallheaders() are not available.

Is there any way to read custom request headers on NGINX server without having to go and update all apps to remove the underscore? Parsing the $_SERVER variable does not work either - any headers using and underscore are dropped.

like image 992
Mark Avatar asked Nov 14 '14 20:11

Mark


1 Answers

You need to set underscores_in_headers on in your NGINX config.

like image 179
cryocide Avatar answered Oct 18 '22 21:10

cryocide