Apache ModRewrite - Patroklo/yii2-oauth2-server GitHub Wiki

Authorization Headers Missing

If you are using Apache and you want to use authorization headers for sending login info into the server you will probably see that they are not working at all.

The cause of this problem it's likely to be that many hosts don't allow by default the use of this header and then you'll have to activate it manually.

How to activate Authorization header in Apache

Open your .htaccess file in charge of the Apache configuration of your Yii2 App Directory and add the following code block after the RewriteEngine On statement:

# Authorization Headers
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

And that should do the trick. Now you will be able to send Authentication headers into your OAuth2 server.