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

What should I do if the 'Authorization' header is missing?

The Authorization header is not accessible by default with PHP-FPM (the solution we use to speed up PHP), but there is an easy 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 line) in their default configuration.


Along the same lines, 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 snippet of code at the beginning of the 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: 17/07/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!