aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-08-11 11:39:01 -0400
committerJoe Mou <dev@mou.fo>2026-08-11 11:57:29 -0400
commit0a39a7a981f619ac64fdeb26294c7cfd4f110a1a (patch)
treebc5539448262980f9d5ca9d3fdaa25fca03a2368 /README.md
parentd76a46b37b12823b5b3976d129c2d4b672a99693 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'README.md')
-rw-r--r--README.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/README.md b/README.md
index 3bcf017..a625116 100644
--- a/README.md
+++ b/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 `<meta http-equiv="refresh">`.
+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.