We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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" http://localhost/ to test



98.9k

You must access the request service:

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

http://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.... http://serverfault.com/questions/403728/nginx-php-fpm-and-custom-header