caddy/modules/caddyhttp/reverseproxy
XYenon 03e6e439dd
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>
2026-02-10 13:00:20 -07:00
..
fastcgi Merge commit from fork 2026-02-10 11:52:36 -07:00
forwardauth chore: fix some comments (#7303) 2025-10-15 03:58:53 +00:00
addresses.go core: Implement socket activation listeners (#6573) 2024-09-30 10:55:03 -06:00
addresses_test.go reverseproxy: do not parse upstream address too early if it contains replaceble parts (#5695) 2023-08-05 23:30:02 +02:00
admin.go fix struct names (#6151) 2024-03-06 13:53:03 +00:00
ascii.go
ascii_test.go filesystem: Globally declared filesystems, fs directive (#5833) 2024-01-13 20:12:43 +00:00
buffering_test.go reverseproxy: more comments about buffering and add new tests (#6778) 2025-03-07 11:22:43 -07:00
caddyfile.go reverseproxy: Customizable dial network for SRV upstreams 2026-02-02 11:25:51 -07:00
command.go cmd: prevent commas in header values from being split (#7268) 2025-09-22 21:12:06 -06:00
copyresponse.go
headers_test.go reverseproxy: fix X-Forwarded-* headers for Unix socket requests (#7463) 2026-02-10 13:00:20 -07:00
healthchecks.go reverse_proxy: use interfaces to modify the behaviors of the transports (#7353) 2025-11-17 09:51:37 -07:00
hosts.go reverseproxy: do not disable keepalive if proxy protocol is used (#7300) 2025-10-21 05:09:37 +00:00
httptransport.go reverseproxy: Set Host to {upstream_hostport} automatically if TLS (#7454) 2026-02-09 13:06:19 -07:00
httptransport_test.go reverseproxy: Set Host to {upstream_hostport} automatically if TLS (#7454) 2026-02-09 13:06:19 -07:00
metrics.go reverseproxy: ignore duplicate collector registration error (#6820) 2025-02-04 10:55:30 +03:00
reverseproxy.go reverseproxy: fix X-Forwarded-* headers for Unix socket requests (#7463) 2026-02-10 13:00:20 -07:00
selectionpolicies.go Use the built-in max/min to simplify the code (#7081) 2025-06-19 16:39:48 -06:00
selectionpolicies_test.go reverseproxy: Allow 0 as weights for weighted_round_robin (#6681) 2024-11-07 17:58:31 -05:00
streaming.go reverseproxy: make error chan bigger when reverse proxying websocket (#7419) 2026-01-06 04:55:47 -05:00
streaming_test.go reverseproxy: Add more debug logs (#5793) 2023-10-11 13:36:20 -06:00
upstreams.go reverseproxy: Customizable dial network for SRV upstreams 2026-02-02 11:25:51 -07:00
upstreams_test.go chore: upgrade .golangci.yml and workflow to v2 (#6924) 2025-06-03 02:24:32 +03:00