Skip to content

fix: resolve real client IP behind Cloudflare and log rejected requests - #16

Merged
Fayupable merged 1 commit into
mainfrom
fayupable/fix-#14
Oct 13, 2026
Merged

Fayupable merged 1 commit into
mainfrom
fayupable/fix-#14

Conversation

@Fayupable

Copy link
Copy Markdown
Owner

Behind Cloudflare, the rightmost public address in X-Forwarded-For is a Cloudflare edge, so the 24h auto-ban hit the edge IP and blocked every visitor routed through it. clientIP now skips private addresses, Cloudflare's published ranges and operator-configured proxies (TRUSTED_PROXY_IPS) when walking the chain from the right.

  • strip the port from RemoteAddr when no forwarded header is present
  • move LoggingMiddleware outside the rate limiter so 403/429 are logged
  • add TRUSTED_PROXY_IPS to config and docker-compose

Behind Cloudflare, the rightmost public address in X-Forwarded-For is a
Cloudflare edge, so the 24h auto-ban hit the edge IP and blocked every
visitor routed through it. clientIP now skips private addresses,
Cloudflare's published ranges and operator-configured proxies
(TRUSTED_PROXY_IPS) when walking the chain from the right.

- strip the port from RemoteAddr when no forwarded header is present
- move LoggingMiddleware outside the rate limiter so 403/429 are logged
- add TRUSTED_PROXY_IPS to config and docker-compose

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@Fayupable Fayupable left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cf ipleri banlanmicak

@github-actions

Copy link
Copy Markdown

Backend Coverage Report

Status: PASS
Total Coverage: 90.4%
Threshold: 70%

Measured on: domain, application/service, adapter/chesscom

@Fayupable
Fayupable merged commit 5aa79b6 into main Oct 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant