mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
fix(http): let operators name their proxy, and survive a bad TRUST_PROXY_HOPS
Forwarding headers were believed from any connection on a private address. Behind Docker Desktop, OrbStack and docker-proxy every connection to a published port arrives from the gateway, a private address, so a caller reaching the port directly could again choose the client address that rate limits, the audit log and sign-in notices record. TRUSTED_PROXY_CIDRS (comma-separated CIDRs) now names the proxies: when set, only those peers may report a client address. The private-range default stays when it is unset, the boot log states the rule in force in one line, and the reverse-proxy guide says what to set for a proxy on the same host, on a Docker network, or on a public address (which, unlisted, puts all clients in one bucket). An invalid TRUST_PROXY_HOPS threw on every request that resolved the client address, so every route answered 500, the health probe included. It now resolves no address, warns once, and is named at boot.
This commit is contained in:
1 parent
0b830e6b02
commit
d87718407e
10 files changed
+501
-38
No files matched your search
@@ -565,6 +565,23 @@ API_TOKEN_HMAC_KEY="<openssl rand -hex 32>"
|
||||
# anonymous callers into one rate-limit bucket.
|
||||
# TRUST_PROXY_HOPS="1"
|
||||
#
|
||||
# The addresses your reverse proxy connects from, as comma-separated CIDRs
|
||||
# (IPv4 or IPv6; a bare address is one host). When set, only those
|
||||
# connections may report the client's address; every other connection is
|
||||
# its own client. When unset, any private address may, which is the old
|
||||
# behaviour and is NOT safe behind Docker Desktop, OrbStack or docker-proxy:
|
||||
# there every caller of the published port arrives from the gateway, a
|
||||
# private address, and could name its own client address. Set it whenever a
|
||||
# reverse proxy is in front:
|
||||
# proxy on the same host (proxying to 127.0.0.1:3000): 127.0.0.1/32,::1/128
|
||||
# proxy container on a Docker network: that network's subnet (docker
|
||||
# network inspect <network>), e.g. 172.18.0.0/16
|
||||
# proxy on another machine with a public address: that address, /32
|
||||
# A proxy on a public address that is not listed is not believed: every
|
||||
# request through it shares the proxy's address and one rate-limit bucket.
|
||||
# The boot log names the rule in force in one [proxy-trust] line.
|
||||
# TRUSTED_PROXY_CIDRS="127.0.0.1/32,::1/128"
|
||||
#
|
||||
# Behind Cloudflare the real visitor IP arrives in the `cf-connecting-ip`
|
||||
# header; the X-Forwarded-For chain otherwise yields the Cloudflare edge IP,
|
||||
# so the audit-log overview stores the CF datacentre address and the geo
|
||||
|
||||
Reference in new issue
Block a user