From 9731ebd1bece1187f943a29da474f4aed6e7ee3b Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Tue, 11 Aug 2026 11:39:01 -0400 Subject: Redirect to GitHub with a meta refresh A browser extension redirects github.com to cgithub with declarative net requests. Its rules match our HTTP redirects back to github.com too, so those bounce straight back here and loop forever. A meta refresh makes cgithub the initiator origin instead, which the extension's rules can exclude, and its delay leaves a page the user can stop on. Co-Authored-By: Claude Opus 5 --- cgithub/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'cgithub/README.md') diff --git a/cgithub/README.md b/cgithub/README.md index 3bcf017..a625116 100644 --- a/cgithub/README.md +++ b/cgithub/README.md @@ -24,6 +24,36 @@ $ pnpm run deploy The worker name and other settings live in `wrangler.jsonc`. +## Browser extension redirects + +Pages cgithub can't render (marketing pages, code search, anything unrouted) are +redirected back to github.com. A browser extension that rewrites github.com URLs +to a cgithub instance with `declarativeNetRequest` will match those redirects +too and send the request straight back, looping forever. + +To avoid this, cgithub never answers with an HTTP redirect: it serves a small +page that navigates to github.com with a two-second ``. +Because that navigation is initiated by the cgithub origin, the extension can +let it through with `excludedInitiatorDomains`; without that, the user at least +lands on a page they can stop on, with a link, instead of an endless loop. + +A rule that redirects to a cgithub instance should therefore look like this: + +```jsonc +{ + "action": { + "type": "redirect", + "redirect": { "transform": { "host": "cgithub.example" } }, + }, + "condition": { + "urlFilter": "||github.com", + "resourceTypes": ["main_frame"], + // So cgithub's own meta refresh to github.com isn't redirected back here. + "excludedInitiatorDomains": ["cgithub.example"], + }, +} +``` + ## Disclosures AI coding assistants, in particular Claude, are used in the development process. -- cgit v1.3.1