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

Access Request Headers from \Phalcon\Mvc\Micro

What's the proper why to get request header information from a Micro?

I've tried this (but its not working for me)

<?php
$app = \Phalcon\Mvc\Micro();
echo $app->getHeader('Public-Id');


6.1k

I'm using curl -v -H "Public-Id: test" https://localhost/ to test



98.9k

You must access the request service:

echo $app->request->getHeader('PUBLIC_ID');

https://docs.phalcon.io/en/latest/api/Phalcon_Http_Request.html



6.1k
Accepted
answer

Sorry, dumb mistake on that one. That was a step in the right direction, I still needed to add configuration changes to nginx.... https://serverfault.com/questions/403728/nginx-php-fpm-and-custom-header