{"action":"created","issue":{"url":"https://api.github.com/repos/jeteokeeffe/php-hmac-rest-api/issues/21","labels_url":"https://api.github.com/repos/jeteokeeffe/php-hmac-rest-api/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/jeteokeeffe/php-hmac-rest-api/issues/21/comments","events_url":"https://api.github.com/repos/jeteokeeffe/php-hmac-rest-api/issues/21/events","html_url":"https://github.com/jeteokeeffe/php-hmac-rest-api/issues/21","id":108457031,"number":21,"title":"API cannot read Authentication Headers on Apache","user":{"login":"vgiotsas","id":5067019,"avatar_url":"https://avatars.githubusercontent.com/u/5067019?v=3","gravatar_id":"","url":"https://api.github.com/users/vgiotsas","html_url":"https://github.com/vgiotsas","followers_url":"https://api.github.com/users/vgiotsas/followers","following_url":"https://api.github.com/users/vgiotsas/following{/other_user}","gists_url":"https://api.github.com/users/vgiotsas/gists{/gist_id}","starred_url":"https://api.github.com/users/vgiotsas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vgiotsas/subscriptions","organizations_url":"https://api.github.com/users/vgiotsas/orgs","repos_url":"https://api.github.com/users/vgiotsas/repos","events_url":"https://api.github.com/users/vgiotsas/events{/privacy}","received_events_url":"https://api.github.com/users/vgiotsas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-26T11:24:13Z","updated_at":"2015-10-09T15:04:01Z","closed_at":null,"body":"When I try to run the `client-connect.php` script it always fails with error 401 (Access Denied). \r\nI did some digging and it appears that the server cannot read the header values that contain the client ID, the time and the hash values.\r\n\r\nAccording to [this post](https://forum.phalconphp.com/discussion/3971/why-are-not-all-headers-returning) Apache will put the HTTP prefix before the header name and it will transform dashes to underscores. So, I changed the header names in the client script and the API's `index.php`.\r\n\r\nIn the `client-connect.php` script (line 28) I changed the headers to:\r\n\r\n`\r\n$headers = ['X-API-ID: ' . $id, 'X-API-TIME: ' . $time, 'X-API-HASH: ' . $hash];\r\n`\r\n\r\nand in the `public\\index.php` (lines 43-45) I changed the header names to:\r\n\r\n```\r\n$clientId = $app->request->getHeader('HTTP_X_API_ID');\r\n$time = $app->request->getHeader('HTTP_X_API_TIME');\r\n$hash = $app->request->getHeader('HTTP_X_API_HASH');\r\n```\r\n\r\nAfter this change the request is authenticated correctly and the client receives the pong message. I'm not sure if the problem is specific to Apache or not, according to the Readme the example uses PHP's built-in server so I assume that it works fine for the built-in server, but I put these changes out here in case more people have the same problem with Apache.  My setup is Phalcon 2.0.8, PHP 5.5.9, Apache 2.4.7"},"comment":{"url":"https://api.github.com/repos/jeteokeeffe/php-hmac-rest-api/issues/comments/146897180","html_url":"https://github.com/jeteokeeffe/php-hmac-rest-api/issues/21#issuecomment-146897180","issue_url":"https://api.github.com/repos/jeteokeeffe/php-hmac-rest-api/issues/21","id":146897180,"user":{"login":"Lomion-tm","id":6087752,"avatar_url":"https://avatars.githubusercontent.com/u/6087752?v=3","gravatar_id":"","url":"https://api.github.com/users/Lomion-tm","html_url":"https://github.com/Lomion-tm","followers_url":"https://api.github.com/users/Lomion-tm/followers","following_url":"https://api.github.com/users/Lomion-tm/following{/other_user}","gists_url":"https://api.github.com/users/Lomion-tm/gists{/gist_id}","starred_url":"https://api.github.com/users/Lomion-tm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lomion-tm/subscriptions","organizations_url":"https://api.github.com/users/Lomion-tm/orgs","repos_url":"https://api.github.com/users/Lomion-tm/repos","events_url":"https://api.github.com/users/Lomion-tm/events{/privacy}","received_events_url":"https://api.github.com/users/Lomion-tm/received_events","type":"User","site_admin":false},"created_at":"2015-10-09T15:04:01Z","updated_at":"2015-10-09T15:04:01Z","body":"It is 100% correct what you are saying! And it is not only Apache specific Hiawatha has the same \"problem\" or better to say the 2 files have the problem. Changed the code like you suggested and everything is up and running fine!\r\n\r\n(Hiawatha 9.14, PHP 5.5.9, Phalcon 2.0.8)"}}