Skip to content

Conversation

@cseufert
Copy link
Contributor

Added a new server configuration option trusted_proxies_unix to support trusting connections to a bind unix://path.sock. This also works with strict mode enabled trusted_proxies_strict.

This allows for seamless setup of (tcp:443) -> caddy -> (unix socket) -> caddy -> php_fastcgi to have the correct remote address available.

Fixes #7263

Assistance Disclosure

"Copilot provided tab completion for code and comments."

@CLAassistant
Copy link

CLAassistant commented Sep 17, 2025

CLA assistant check
All committers have signed the CLA.

@francislavoie
Copy link
Member

Thanks!

Let's make it a boolean instead of int, the reason strict is an int is because it's meant to have the dual purpose (eventually) to mean the N-th IP (iirc) from the right of the XFF header.

Also please add a Caddyfile adapt test (look for .caddyfiletest files)

@cseufert
Copy link
Contributor Author

Thanks!

Let's make it a boolean instead of int, the reason strict is an int is because it's meant to have the dual purpose (eventually) to mean the N-th IP (iirc) from the right of the XFF header.

Also please add a Caddyfile adapt test (look for .caddyfiletest files)

Makes sense, created a .caddyfiletest and changed to bool. Let me know if i need more for the adapt side. Also I have no clue what is actually failing on the last CI build on Mac OS

@cseufert
Copy link
Contributor Author

@francislavoie is this likely to get merged, or should I open a PR for a different approach?

@francislavoie
Copy link
Member

Yes sorry, it will be merged soon. It fell off my radar.

@francislavoie francislavoie added this to the v2.11.0 milestone Sep 29, 2025
@francislavoie francislavoie changed the title Support for trusting unix socket X-Forwarded-* headers caddyhttp: Add trusted_proxies_unix for trusting unix socket X-Forwarded-* headers Sep 29, 2025
@francislavoie francislavoie modified the milestones: v2.11.0, v2.10.3 Sep 29, 2025
@francislavoie francislavoie enabled auto-merge (squash) September 29, 2025 11:34
@francislavoie francislavoie added the feature ⚙️ New feature or request label Sep 29, 2025
@francislavoie francislavoie modified the milestones: v2.10.3, v2.11.0 Oct 16, 2025
cseufert and others added 3 commits October 15, 2025 22:41
Added a new server configuration option `trusted_proxies_unix` to support trusting connections to a `bind unix://path.sock`. This also works with strict mode enabled `trusted_proxies_strict`.

This allows for seamless setup of `(tcp:443) -> caddy -> (unix socket) -> caddy -> php_fastcgi` to have the correct remote address available.

Fixes caddyserver#7263
Added .caddyfiletest case for trusted_proxies_unix
@francislavoie francislavoie merged commit d7185fd into caddyserver:master Oct 16, 2025
23 checks passed
@mohammed90 mohammed90 mentioned this pull request Oct 25, 2025
45 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature ⚙️ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to enable trusted_proxies for unix socket files

3 participants