Author Topic: NGINX missing Authorization header when proxing to Apache  (Read 1448 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
NGINX missing Authorization header when proxing to Apache
« 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

Offline
*
Re: NGINX missing Authorization header when proxing to Apache
« Reply #1 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