From b84cfe647432965c3d677404456ce29a1a8c6292 Mon Sep 17 00:00:00 2001 From: Keith Smith Date: Sat, 31 Oct 2026 15:35:07 -0600 Subject: [PATCH] Document the Nginx Proxy Manager fix for S8's X-Forwarded-For spoofing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docs/install.md covered the raw-nginx case via nginx.conf.example, but gave no concrete guidance for Nginx Proxy Manager specifically, whose generated config also defaults to the appending (spoofable) form of X-Forwarded-For — the same production deployment this review is based on uses NPM. Documents the Advanced tab / Custom Nginx Configuration override, why it takes effect ahead of NPM's own default header, and a note for anyone with something in front of NPM itself. Co-Authored-By: Claude Sonnet 5 --- docs/install.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/install.md b/docs/install.md index 3c41778..a837518 100644 --- a/docs/install.md +++ b/docs/install.md @@ -274,6 +274,25 @@ next paragraph for why it matters). Whichever proxy you use, headers that need forwarding either way, including that overwrite-not- append distinction for `X-Forwarded-For`. +**Nginx Proxy Manager specifically:** NPM's generated config already sets +`X-Forwarded-For` to the appending (unsafe) form by default — override it +per proxy host rather than editing NPM's own templates: open the proxy +host entry for Evection, go to its **Advanced** tab, and add this to the +**Custom Nginx Configuration** box: + +```nginx +proxy_set_header X-Forwarded-For $remote_addr; +``` + +This lands inside NPM's own `location` block, after its default headers, +so nginx uses this one (the last `proxy_set_header` for a given name in +the same block wins) — no edit to any file NPM manages, and it survives +NPM regenerating its config. Save, and NPM reloads nginx for you. If +something else sits in front of NPM itself (a CDN, another load balancer, +Cloudflare, ...), `$remote_addr` at NPM's layer is that upstream's +address, not the original client — forward whatever *that* layer's own +trusted client-IP header says instead. + Either way, the proxy must set `X-Forwarded-Proto: https` on requests it forwards once it's terminating TLS — Evection's `prod` settings (`SECURE_PROXY_SSL_HEADER` in `config/settings/prod.py`) trust that header to