fix(site): serve the legacy druxtjs.org redirects from the app, not nginx - #821
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Nuxt static server now loads ChangesLegacy redirect handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Legacy druxtjs.org routes now receive one-hop 301 redirects with preserved query strings, backed by the shared redirect map in the runtime image. The covered behavior is ready to merge. Sequence Diagram(s)sequenceDiagram
participant HTTPClient
participant StaticServer
participant RedirectMap
StaticServer->>RedirectMap: loadRedirects(map file)
RedirectMap-->>StaticServer: redirect rules
HTTPClient->>StaticServer: request legacy pathname
StaticServer-->>HTTPClient: 301 target with preserved query
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #821 +/- ##
========================================
Coverage 81.79% 81.79%
========================================
Files 112 112
Lines 3054 3054
Branches 693 653 -40
========================================
Hits 2498 2498
Misses 452 452
Partials 104 104 🚀 New features to boost your workflow:
|
|
@CodeRabbit review |
✅ Action performedReview finished.
|
Problem
.lagoon.ymlroutesdruxtjs.organdwww.druxtjs.orgto theappservice. Thenginxservice, which is the only thing that loads.lagoon/redirects-map.conf, serves the package subdomains alone. So the 49druxtjs.orgrules in the map, the/guide/*and/guides/*Diataxis moves among them, can never fire.verify-redirects.shchecks the map's syntax and targets, not which service receives the host, so it stayed green.Today the legacy
/guide/*pages are still served by the old site. After the docs restructure ships,scripts/serve.jsanswers them with a real 404.Fix
scripts/serve.jsloads the same map file and answers itsdruxtjs.orgrules itself, before the trailing-slash redirect so a slashed legacy URL lands in one hop. Targets are made relative so a preview environment stays on its own host, and slashless so the canonical redirect does not add a second hop.The runtime image copies
.lagoon/redirects-map.confbeside the site; a repo checkout finds it in.lagoon/.REDIRECTS_MAPoverrides both. The server logs how many rules it loaded and from where, or that it found no map, so the deploy log shows whether the file made it into the image.The map stays the single source of truth for both services.
Verification
docs/nuxt/test/unit/serve.test.js: six new cases. Parsing (druxtjs.org rules only, subdomain and$request_urirules skipped, targets relative and slashless), a 301 with the query preserved, slashed and.htmlforms in one hop, anchoring, the real map loading everydruxtjs.orgrule and resolving/guide,/guide/getting-started,/guide/theming,/guide/deprecations,/guides/node-clientand/api/stores/schema.htmlto the targets corrected in fix(docs): correct two redirect targets and verify the map in CI #819, and no map meaning no redirects. With the lookup disabled, two of them fail; with it, 17 of 17 pass.node scripts/serve.jsfrom the checkout logs49 legacy redirectsand answers/guide/theming/with301 /how-to/theming,/guide/deprecations.htmlwith301 /modules/druxt/deprecations, and/guide/nopewith404.druxtjs.orgrules in the map answer with a 301 to the expected relative target in one hop, and every target returns 200./guide/theming/and/guide/theming?ref=1land on/how-to/themingand/how-to/theming?ref=1;/guide/nopeis a 404; the trailing-slash canonical redirect is unchanged.Summary by CodeRabbit
.htmlURL variants while preserving query parameters.