middleware: take the client address from the right of X-Forwarded-For (closes #181)
check / check (push) Failing after 39s
check / check (push) Failing after 39s
realIP took the first X-Forwarded-For entry, which the client itself can write, so behind a proxy that appends to the header a client chose the address dnswatcher logs and the /metrics rate limit counts. It now walks the entries from the right past trusted proxies, using the existing trusted-proxy check, and takes the first that is not one; the leftmost when all are. All X-Forwarded-For header lines are read as one list, since a proxy may add its own line instead of appending to the client's. An empty entry where the client address belongs falls back to the peer address, as an empty first entry did before. X-Real-IP is unchanged. Model: opus-5-5
This commit is contained in:
@@ -20,6 +20,8 @@ https://git.eeqj.de/sneak/dnswatcher/issues/104
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-10-01: the client address from `X-Forwarded-For` is the last entry that
|
||||
is not a trusted proxy, not the first, which the client sets (closes #181).
|
||||
- 2026-10-01: `/metrics` allows each client address 30 requests a minute,
|
||||
counted before Basic Auth, and answers 429 beyond that (closes #101).
|
||||
- 2026-10-01: the image built by `make docker` reports the `git describe`
|
||||
|
||||
Reference in New Issue
Block a user