NGINX missing Authorization header when proxing to Apache

Started by Joseph, November 28, 2022, 11:36:06 AM

Previous topic - Next topic

Joseph

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

Joseph

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