We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Can't get headers from Phalcon\Http\Request

Hi, I am trying to retrieve headers from Phalcon\Http\Request, and always get empty strgin e.g: $useragentheader = $this->request->getHeader("User-Agent"); when I use php's function getallheaders() I can't see all my headers, but when I uses Phalcon request object to retrieve header value I allays get empty string



19.1k
Accepted
answer
edited Jul '14

If any body is interested :) The problem was as follow (and it's was my own problem): I created GET request with custom header: X-Papi-Signature. Then on the server I tried to get this header like this: $this->request->getHeader("X-Papi-Signature");

But when I looked in to $_SERVER array I realized that my header is actually HTTP_X_PAPI_SIGNATURE.

So executing of $this->request->getHeader("HTTP_X_PAPI_SIGNATURE"); was as expected