feat: add IP blacklist support to Cloudflare Worker edge layer (Fixes #1045)#1154
Closed
zeroknowledge0x wants to merge 1 commit into
Closed
feat: add IP blacklist support to Cloudflare Worker edge layer (Fixes #1045)#1154zeroknowledge0x wants to merge 1 commit into
zeroknowledge0x wants to merge 1 commit into
Conversation
…ublime247#1045) - Add IP_BLACKLIST env var for comma-separated IPs/CIDRs - Support exact IP and CIDR range matching (e.g. 192.168.1.0/24) - Block requests at the edge before they reach the origin - Log blocked requests with structured JSON for monitoring - Use cf-connecting-ip header for accurate client IP detection - Add comprehensive unit tests for IP matching logic - Document configuration in wrangler.toml with examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1045
Summary
Adds edge-level IP blacklist support to the well-known-cache Cloudflare Worker, blocking malicious requests before they reach the origin server.
Changes
IP_BLACKLISTenv var (comma-separated IPs/CIDRs)203.0.113.1198.51.100.0/24203.0.113.1,198.51.100.0/24,192.0.2.5cf-connecting-ipheader (Cloudflare's real client IP)Configuration
Add to
wrangler.tomlvars:Or set via
wrangler secret put IP_BLACKLISTfor production.Testing
Security
cf-connecting-ip(Cloudflare-provided) for reliable client IPx-forwarded-forfirst entry