Skip to content

fix: include Host in apache_request_headers() for HTTP/1.1 requests - #2877

Open
lazerg wants to merge 2 commits into
php:mainfrom
lazerg:fix/apache-request-headers-host
Open

lazerg wants to merge 2 commits into
php:mainfrom
lazerg:fix/apache-request-headers-host

Conversation

@lazerg

@lazerg lazerg commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

For HTTP/1.1 requests, net/http moves Host out of Request.Header into Request.Host, so apache_request_headers() and getallheaders() never returned it. The value was only reported when a host field stayed in the header map, which happens over HTTP/2.

Host is now always added from request.Host (when set), and the header map's own Host field is skipped, so the result matches $_SERVER['HTTP_HOST'], Apache and PHP-FPM on every protocol.

Fixes #2876

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getallheaders() / apache_request_headers() do not return the Host header

1 participant