mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
fix(http): say when proxy headers go unread, and trust X-Real-IP only at one hop
With TRUST_PROXY_HOPS=0 behind a proxy that sends only X-Real-IP, every client address resolves to nothing and all anonymous sign-ins share one rate-limit bucket, with nothing in the log to say why. The first request that carries a forwarding header the setting does not let HealthLog read now logs one warning naming the header and the setting to change. X-Real-IP stood in for a missing X-Forwarded-For at any hop count. It is a single address, so it is now read only with TRUST_PROXY_HOPS=1; with two or more hops the chain the count describes is X-Forwarded-For. The upload, import and native batch routes that bypass the proxy now carry Cross-Origin-Resource-Policy and Cross-Origin-Embedder-Policy like every other response, and so do the proxy's early exits. The env examples described an unset TRUST_PROXY_HOPS as right for a directly exposed host; unset means one hop, and that host wants 0.
This commit is contained in:
1 parent
995bd2385a
commit
7d05f68f23
7 files changed
+142
-17
No files matched your search
+5
-4
@@ -202,10 +202,11 @@ API_TOKEN_HMAC_KEY="REPLACE-WITH-OUTPUT-OF-openssl-rand-hex-32"
|
||||
# operator — there is no way for the server to detect whether the flag
|
||||
# matches the real deployment topology. When in doubt, leave it off.
|
||||
# Number of trusted reverse-proxy hops in front of the app. The client IP is
|
||||
# read that many entries from the right of the X-Forwarded-For chain. Leave
|
||||
# unset for a directly-exposed host; set to 1 behind a single reverse proxy.
|
||||
# A wrong value makes the app refuse to read XFF and share one rate-limit
|
||||
# bucket across all anonymous callers.
|
||||
# read that many entries from the right of the X-Forwarded-For chain. Set 0
|
||||
# for a directly-exposed host; 1 (the default when unset) behind a single
|
||||
# reverse proxy. X-Real-IP is read only at 1. A wrong value makes the app
|
||||
# refuse the headers, log one warning, and share one rate-limit bucket across
|
||||
# all anonymous callers.
|
||||
# TRUST_PROXY_HOPS="1"
|
||||
# TRUST_CF_CONNECTING_IP=""
|
||||
|
||||
|
||||
Reference in new issue
Block a user