Missing HTTP Authorization Header

If you need access to the Authorization HTTP header, you’ll need to adjust the Apache & NGINX settings in Plesk. First, log in to the Plesk Control Panel and select the website for which you need the header.


Next, select “Additional Settings for Apache & NGINX” and enter the following in the additional directives for HTTP and HTTPS:


RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]



Then save the settings. From now on, the HTTP Authorization header will be part of the $_SERVER superglobal available in PHP.



Testing the HTTP Header

In the following example, the value is checked using Insomnia:


Example PHP script:

<?php

echo $_SERVER['HTTP_AUTHORIZATION'];