Slim Framework: missing Authorization header in Apache server


You can’t get Authorization header in Apache server:

$request->getHeader("Authorization")

You can get this header with this method:

$headers = apache_request_headers();
$headers["Authorization"];

But when you use oauth2-client you can’t use that method.

You must use .htaccess file:

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.+)
RewriteRule . - [e=HTTP_AUTHORIZATION:%1]

Leave a Reply