Skip to content

feat: populate SERVER_ADDR - #2809

Merged
dunglas merged 1 commit into
mainfrom
feat/server-addr
Nov 5, 2026
Merged

dunglas merged 1 commit into
mainfrom
feat/server-addr

Conversation

@dunglas

@dunglas dunglas commented Nov 4, 2026

Copy link
Copy Markdown
Member

Sets $_SERVER['SERVER_ADDR'] to the IP address that accepted the connection, as Caddy's FastCGI transport, nginx and Apache do. Unix socket listeners have no IP address, so SERVER_ADDR stays unset there, and an operator-defined env SERVER_ADDR still overrides it.

Port of caddyserver/caddy#7912 (caddyserver/caddy@546752e).

Claude Code (Claude Opus 5.5) wrote this port and its test.

Set $_SERVER['SERVER_ADDR'] to the IP address that accepted the
connection, as Caddy's FastCGI transport, nginx and Apache do. Unix
socket listeners have no IP address, so SERVER_ADDR stays unset there.

@henderkes henderkes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think it's actually part of the cgi spec, pho applications shouldn't rely on it, but I don't mind setting it.

@dunglas
dunglas merged commit fe6c524 into main Nov 5, 2026
44 of 45 checks passed
@dunglas
dunglas deleted the feat/server-addr branch November 5, 2026 07:19
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.

2 participants