INBUXA_HTTP_USE_FORWARDED: read the forwarding header without a store setting #467

Merged
jcoffey-dev merged 1 commits from feat/http-use-forwarded-env into main 2026-11-19 03:00:29 +00:00
Owner

Found while testing K-W3 (sign-in limits with several webmail replicas) on kind.

The problem. "Use X-Forwarded-For" is off by default, so behind a proxy the server counts every client as the proxy:

  • Failed sign-ins are banned per address (100 a day, then 30 days). Enough wrong passwords between all users behind one ingress ban the ingress, and nobody can sign in on the web.
  • Anonymous requests, which include the first use of each new token on each node, are limited per address (100 a minute). The webmail sends every user's tokens from its own address.

The trusted proxies and the header name could already be set from the environment (INBUXA_HTTP_TRUSTED_PROXIES, INBUXA_HTTP_FORWARDED_HEADER); whether to read the header at all couldn't.

The change. INBUXA_HTTP_USE_FORWARDED=true|false (also 1/0, yes/no, on/off) overrides the store's setting. An unparseable value logs a build warning and the store's setting applies. The trusted proxies still decide whose header is believed.

Tested

  • A unit test for the value parsing.
  • On kind with this build and the chart setting it (inbuxa-charts, K-W3): a pod forwarding 110 failed sign-ins for 110 different clients bans nobody. On rc.31 behaviour the same run banned the forwarding pod after 101.
  • Failed sign-ins are counted across server pods: 110 wrong passwords alternating between two front pods banned at 101.

No CHANGELOG entry here; the version PR writes it. The variable needs documenting next to the other INBUXA_HTTP_* ones.

Found while testing K-W3 (sign-in limits with several webmail replicas) on kind. **The problem.** "Use X-Forwarded-For" is off by default, so behind a proxy the server counts every client as the proxy: - Failed sign-ins are banned per address (100 a day, then 30 days). Enough wrong passwords between all users behind one ingress ban the ingress, and nobody can sign in on the web. - Anonymous requests, which include the first use of each new token on each node, are limited per address (100 a minute). The webmail sends every user's tokens from its own address. The trusted proxies and the header name could already be set from the environment (`INBUXA_HTTP_TRUSTED_PROXIES`, `INBUXA_HTTP_FORWARDED_HEADER`); whether to read the header at all couldn't. **The change.** `INBUXA_HTTP_USE_FORWARDED=true|false` (also 1/0, yes/no, on/off) overrides the store's setting. An unparseable value logs a build warning and the store's setting applies. The trusted proxies still decide whose header is believed. **Tested** - A unit test for the value parsing. - On kind with this build and the chart setting it (inbuxa-charts, K-W3): a pod forwarding 110 failed sign-ins for 110 different clients bans nobody. On rc.31 behaviour the same run banned the forwarding pod after 101. - Failed sign-ins are counted across server pods: 110 wrong passwords alternating between two front pods banned at 101. No CHANGELOG entry here; the version PR writes it. The variable needs documenting next to the other `INBUXA_HTTP_*` ones.
jcoffey-dev added 1 commit 2026-11-19 02:46:59 +00:00
INBUXA_HTTP_USE_FORWARDED: read the forwarding header without a store setting
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 12m8s
687108b349
A deployment that only ever reaches the server through its own proxies
(Kubernetes, behind an ingress, with the webmail) needs the server to count
clients by the address those proxies pass on: otherwise the limits and bans
for failed sign-ins and anonymous requests charge everything to the proxy,
and a hundred wrong passwords a day between all users ban it. true or false
overrides the store's "Use X-Forwarded-For"; trusted proxies still apply.
jcoffey-dev merged commit f80e928cfb into main 2026-11-19 03:00:29 +00:00
jcoffey-dev deleted branch feat/http-use-forwarded-env 2026-11-19 03:00:30 +00:00
Sign in to join this conversation.