Skip to content

Commit 5c4e05e

Browse files
committed
Configure trusted proxies to preserve the forwarded IP
Without this, Scaleway's Envoy passes X-Forwarded-For through, telling us who the original client is, but then then Caddy refuses to trust them, and so every request comes from 127.0.0.1.
1 parent a49952b commit 5c4e05e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Caddyfile

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
{
2+
servers {
3+
# We trust (configurably) X-Forwarded-For headers from traffic that's proxied through
4+
# localhost, e.g. through SCW's Envoy container proxy. Without this all traffic appears
5+
# to come directly from localhost, ignoring the data Envoy passes through.
6+
trusted_proxies static {$TRUSTED_PROXIES:127.0.0.1}
7+
}
8+
}
9+
110
# We use the domain name (via Host header) to decide which upstream service we
211
# should forward the traffic to:
312
{$EVENTS_DOMAIN:events.httptoolkit.tech} {

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM caddy:2.6.1-alpine
1+
FROM caddy:2.6.4-alpine
22

33
COPY ./Caddyfile /etc/caddy/Caddyfile

0 commit comments

Comments
 (0)