Home  >  Article  >  Backend Development  >  How to Fix Authorization Headers Problem in Apache 2.4 PHP-FPM?

How to Fix Authorization Headers Problem in Apache 2.4 PHP-FPM?

Barbara Streisand
Barbara StreisandOriginal
2024-10-22 20:48:02408browse

How to Fix Authorization Headers Problem in Apache 2.4   PHP-FPM?

Apache 2.4 PHP-FPM: Authorization Headers Problem

Issue:

Authorization headers are not being passed from Apache 2.4's mod_proxy to PHP-FPM, preventing access to certain features, such as APC's user cache monitoring.

Solution:

1. Identify the Stripping Module:

Determine which Apache module is stripping the Authorization headers. This may require extensive debugging or checking module configurations.

2. Override Module Settings:

Find the specific configuration setting within the problematic module that allows you to preserve the Authorization headers. This setting varies depending on the module.

3. Pass Headers via Env Variables:

If overriding module settings is not possible, you can pass the Authorization header directly to PHP using environment variables:

<code class="apache">SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=</code>

4. Update PHP Code:

In some cases, you may need to modify your PHP code to access the Authorization header using $_SERVER['REDIRECT_HTTP_AUTHORIZATION'] instead of $_SERVER['HTTP_AUTHORIZATION'].

The above is the detailed content of How to Fix Authorization Headers Problem in Apache 2.4 PHP-FPM?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn