Repository navigation
feat(infra): a Cloudflare Worker that answers short repo URLs with HTTP 200 - #772
Merged
Merged
Conversation
…TP 200 GitHub Pages answers a repo's short URL with 404.html and status 404, so link previews, crawlers and curl stop there. Pages can't rewrite or change the status. The Worker passes every response through, except a 404 for a path the 404.html shim expands, which it sends with status 200 and the same body and headers. It is generated from the shim's own source. Deploying it needs the Cloudflare proxy in front of the site (docs/hosting.md section 9). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
… it changes, route limits, re-paste on change Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem
Opened fresh, a repo's short URL returns HTTP 404 before the app loads, for example
https://forge.dashhq.org/forge/dash-forgeorhttps://testnet-forge.dashhq.org/pasta-demo/pocket-wallet(checked 2026-11-27). People never notice, because404.html's shim opens the app. Link previews, crawlers andcurlstop at the 404.The limit: GitHub Pages answers every path it has no file for with
404.htmland status 404. It has no rewrites and no way to change the status. Short URLs are dynamic (any owner or repo, created after the build), so they can't be pre-rendered as files either. The 200 has to come from something in front of Pages.Change
infra/pages-deep-links/worker.js, a Cloudflare Worker. It passes every response through unchanged, except a 404 for a path the 404.html shim expands, which it sends with status 200 and the same body and headers.forge-web/lib/deep-link-worker.tsusesSHORT_URL_EXPAND_SOURCEandRESERVED_SEGMENTS), so the two can't disagree.deep-link-worker.test.ts):/nope,/_next/…,/icons/…,/explore/x, non-numeric issue);wrangler dev(workerd) in front of the live forge.dashhq.org returned:/forge/dash-forgeand/forge/dash-forge/issues, with a body byte-identical to what Pages sends today;/nope/x/y/zand a missing/_next/staticfile;/and/explore/.docs/hosting.md§9 gives the deploy steps, as part of the existing "Cloudflare proxy in front of forge.dashhq.org" section, and the check commands.Not done here (owner-only)
Deploying needs the Cloudflare proxy turned on for
forge.dashhq.org(andtestnet-forge, which is still DNS-only), plus a Worker route. That is Pasta's call; it also bears on #716 (beacon) and the HTML-rewriting settings in §6. Merging this PR changes nothing that is live.Compat
Nothing deployed changes. When the Worker is on, the response bodies are the same bytes, so
dg verify-appis unaffected by the Worker itself (§6 covers the proxy's own HTML features). The canonical/repo/?…URLs and every existing short link keep working; they just get 200.🤖 Generated with Claude Code