Control Web Panel

WebPanel => CentOS 7 Problems => Topic started by: Joseph on November 28, 2022, 11:36:06 AM

Title: NGINX missing Authorization header when proxing to Apache
Post by: Joseph on November 28, 2022, 11:36:06 AM
Hi people,

I'm using the following settings:

- Apache + NGINX
- PHP + PHP-FPM

The problem I'm facing is that NGIX when proxying to Apache is not passing the Authorization header.

Has anyone faced this problem?

Best regards
Title: Re: NGINX missing Authorization header when proxing to Apache
Post by: Joseph on November 29, 2022, 07:35:55 PM
Hello guys,

After investigations, I was able to identify the problem.

As you are using FPM together with PHP, it is necessary to make some code changes:

- In the PHP project you must add the line in .htaccess:
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

- And to retrieve the Authorization header, you must call the variable:
$_SERVER['REDIRECT_HTTP_AUTHORIZATION']

I share the solution for everyone's knowledge.

Best regards