SIGN IN SIGN UP
caddyserver / caddy UNCLAIMED

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

0 0 104 Go

reverseproxy: fix X-Forwarded-* headers for Unix socket requests (#7463)

When a request arrives via a Unix domain socket (RemoteAddr == "@"),
net.SplitHostPort fails, causing addForwardedHeaders to strip all
X-Forwarded-* headers even when the connection is trusted via
trusted_proxies_unix.

Handle Unix socket connections before parsing RemoteAddr: if untrusted,
strip headers for security; if trusted, let clientIP remain empty (no
peer IP for a Unix socket hop) and fall through to the shared header
logic, preserving the existing XFF chain without appending a spurious
entry.

Amp-Thread-ID: https://ampcode.com/threads/T-019c4225-a0ad-7283-ac56-e2c01eae1103

Co-authored-by: Amp <amp@ampcode.com>
X
XYenon committed
03e6e439dd07d048323cc39516146e0f04032186
Parent: 7c28c0c
Committed by GitHub <noreply@github.com> on 2/10/2026, 8:00:20 PM