feat(blocklist): block domains listed in config.json at the cache-bucket root - #22
Merged
Conversation
…ket root
An optional { "blocked_domains": [...] } config file at the root of the
shared cache bucket (FUSE-mounted at CACHE_DIR) stops the proxy from
retrieving, caching, or serving matching hosts. Wildcard entries
(*.example.com) use the same subdomain+apex semantics as WHITELIST_HOSTS.
Blocked requests fail with a distinct 451 status on every path (HTTP,
SSE, WebSocket, admin crawl), and prewarm skips blocked asset hosts
embedded in allowed pages. A missing file means no blocklist; the list
is re-read at most once per minute so bucket edits apply without a
restart, and a malformed file keeps the previously loaded list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Adds an optional domain blocklist to the time-machine-web-proxy. An optional
config.jsonat the root of the shared cache bucket (FUSE-mounted atCACHE_DIR) stops the proxy from retrieving, caching, or serving matching hosts.{ "blocked_domains": ["example.com", "*.tracker.net"] }Behavior
blocked_domains— array of hosts. Wildcard entries (*.example.com) use the same subdomain+apex semantics asWHITELIST_HOSTS.config.jsonis absent.HTTP 451on every path: HTTP, SSE, WebSocket, and admin crawl.Files
src/lib/blocklist.ts(new) — core loader + matchersrc/lib/dependencies.ts,src/services/proxy.ts,src/services/time-machine.ts— wiringtests/lib/blocklist.test.ts,tests/services/proxy.test.ts— coverageREADME.md— docs🤖 Generated with Claude Code