fix(GEN-3647): restore api.gen.pro docs routing after CloudFront exit - #19
Open
mavxdegods wants to merge 2 commits into
Open
mavxdegods wants to merge 2 commits into
mavxdegods wants to merge 2 commits into
Conversation
api.gen.pro serves both the Rails API (/v1, /up) and the Astro docs site (GitHub Pages, poweredbygen.github.io/api-docs). CloudFront used to split the paths and rewrite the Pages origin to /api-docs. The Hetzner migration removed CloudFront and pointed api.gen.pro entirely at Rails, so every docs path (/, /llms.txt, /openapi.yaml, /guides/*, /reference/*) now 404s. Adds edge-routing artifacts (no code redeploy of the docs needed): - cloudflare/api-gen-pro-router.worker.js: Worker that routes API prefixes to the Rails origin and all other paths to GitHub Pages (prepending /api-docs, rewriting Pages redirects back to api.gen.pro). - cloudflare/DEPLOY.md: Worker deploy + verify steps. - cloudflare/DEPLOY-no-worker.md: native Origin Rules + URL Rewrite alternative. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
api.gen.pro is a proxied CNAME to origin-app1.gen.pro (grey-cloud, 5.161.246.2, Rails). Use that existing unproxied backend hostname as the Worker origin instead of a new origin-api record. Matches what is deployed live as the gen-api-docs-router Worker. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This branch has not been deployed
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.
Incident
https://api.gen.prodocs site returns 404 on every path (/,/llms.txt,/llms-full.txt,/openapi.yaml,/guides/*,/reference/*,/cards/*). Reported as "the site is down."The API itself is healthy —
/up=200,/v1/templates/projects=200,/v1/agents=401. Only the docs website is down.Root cause
api.gen.prois a dual-purpose host:/v1,/up, … → Rails (gen-backend-v2, now Hetzner5.161.246.2)poweredbygen.github.io/api-docs/)A CloudFront distribution used to split these paths and rewrite the Pages origin path to
/api-docs. The CloudFront exit (Hetzner migration, GEN-3617 / GEN-3620) removed CloudFront and pointedapi.gen.proentirely at Rails → Rails has no docs routes → every docs path 404s. Docs content is intact at the Pages origin (verified 200).Compounding fragility:
astro.confighassite: 'https://api.gen.pro'with nobase:and no CNAME, so published assets are root-relative (/_astro/*) but Pages serves them under/api-docs/_astro/*— only ever worked because the old edge rewrote the origin path.Fix (this PR)
Edge-routing artifacts — no redeploy of the docs needed:
cloudflare/api-gen-pro-router.worker.js— Worker bound toapi.gen.pro/*: API prefixes → Rails origin, all else → GitHub Pages (/api-docsprepend + Pages-redirect rewrite). Recommended.cloudflare/DEPLOY.md— Worker deploy + verify steps.cloudflare/DEPLOY-no-worker.md— native Origin Rules + URL Rewrite alternative (no code).Verify after deploy
Monitoring (self-healing rule)
Added
api-docs-route-monitor.timeron Hetznerbox-trendpulse(5-min synthetic probe; alerts if docs paths ≠ 200 while/uphealthy).checked:no_safe_auto_fix_mapped.Permanent hardening (follow-up)
Move docs to
docs.gen.pro(Pages custom-domain CNAME) or set Astrobase: '/api-docs'.Tracking: GEN-3647 · Related: GEN-3617, GEN-3620, GEN-2768
🤖 Generated with Claude Code