Articles on: Web Hosting
This article is also available in:

The "Authorization" header is missing, what to do?

The Authorization header is not accessible by default with PHP-FPM (the solution we use to speed up PHP), but there is a simple way to retrieve it.


Simply add the following line to your .htaccess file:


SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1Note: Several frameworks already include such a line (or an equivalent one) in their default configuration.


Similarly, if you expect to find the PHP_AUTH_USER or PHP_AUTH_PW variables, they are not present either, but you can recreate them by adding this code snippet at the beginning of your PHP files that need these variables:


list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));

Updated on: 14/02/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!