I am also having this issue on an EC2 instance with the latest Amazon Linux build. The getallheaders()
function doesn't work when on nginx
. All of the posted replacements for getallheaders()
only get values from $_SERVER
. The problem is that the headers I need are not there.
I am testing my original implementation using Postman (a Chrome App). It has a Headers tab and a Body tab. I can find the entries in the Body tab in the $_POST
array. The entries in the Headers tab are not there or in any of the other global arrays.
The code I'm working on is a web service for an app (that I don't control), so I can't change the nature of the calls.
Here are the Headers that I get when calling getallheaders()
running on Apache (I removed a few for clarity):
Array
(
[Host] => api.dashforhealth.com
[Connection] => keep-alive
[Cache-Control] => no-cache
[Origin] => chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
[api_key] => this-is-not-the-real-api-key
[Content-Type] => application/x-www-form-urlencoded
[Postman-Token] => 76069288-e74e-3791-eb42-f166454d8822
[auth_key] => this-is-not-the-real-auth-key
[Accept] => */*
)
The two I'm interested in are api_key
and auth_key
. How can I get these headers when running in nginx
?