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

Barbara Streisand
Release: 2024-10-22 20:48:02
Original
406 people have browsed it

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>
Copy after login

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!

source:php
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!