Document the Nginx Proxy Manager fix for S8's X-Forwarded-For spoofing

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 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-10-31 15:35:07 -06:00
1 parent ca03a5994b
commit b84cfe6474
1 file changed
+19
+19
View File
@@ -274,6 +274,25 @@ next paragraph for why it matters). Whichever proxy you use,
headers that need forwarding either way, including that overwrite-not- headers that need forwarding either way, including that overwrite-not-
append distinction for `X-Forwarded-For`. 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 Either way, the proxy must set `X-Forwarded-Proto: https` on requests it
forwards once it's terminating TLS — Evection's `prod` settings forwards once it's terminating TLS — Evection's `prod` settings
(`SECURE_PROXY_SSL_HEADER` in `config/settings/prod.py`) trust that header to (`SECURE_PROXY_SSL_HEADER` in `config/settings/prod.py`) trust that header to