Skip to content

fix(site): serve the legacy druxtjs.org redirects from the app, not nginx - #821

Merged
Decipher merged 1 commit into
developfrom
feature/docs-legacy-redirects
Sep 6, 2026
Merged

fix(site): serve the legacy druxtjs.org redirects from the app, not nginx#821
Decipher merged 1 commit into
developfrom
feature/docs-legacy-redirects

Conversation

@Decipher

@Decipher Decipher commented Sep 6, 2026

Copy link
Copy Markdown
Member

Problem

.lagoon.yml routes druxtjs.org and www.druxtjs.org to the app service. The nginx service, which is the only thing that loads .lagoon/redirects-map.conf, serves the package subdomains alone. So the 49 druxtjs.org rules in the map, the /guide/* and /guides/* Diataxis moves among them, can never fire. verify-redirects.sh checks 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.js answers them with a real 404.

Fix

scripts/serve.js loads the same map file and answers its druxtjs.org rules 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.conf beside the site; a repo checkout finds it in .lagoon/. REDIRECTS_MAP overrides 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_uri rules skipped, targets relative and slashless), a 301 with the query preserved, slashed and .html forms in one hop, anchoring, the real map loading every druxtjs.org rule and resolving /guide, /guide/getting-started, /guide/theming, /guide/deprecations, /guides/node-client and /api/stores/schema.html to 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.js from the checkout logs 49 legacy redirects and answers /guide/theming/ with 301 /how-to/theming, /guide/deprecations.html with 301 /modules/druxt/deprecations, and /guide/nope with 404.
  • The Lagoon preview for this branch, built from the runtime image: all 49 druxtjs.org rules 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=1 land on /how-to/theming and /how-to/theming?ref=1; /guide/nope is a 404; the trailing-slash canonical redirect is unchanged.

Summary by CodeRabbit

  • Bug Fixes
    • Added automatic permanent redirects for legacy URLs to their current destinations.
    • Redirects now support trailing-slash and .html URL variants while preserving query parameters.
    • Improved handling of legacy redirect rules, including accurate path matching and graceful behavior when redirect configuration is unavailable.

@changeset-bot

changeset-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 415cd67

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 2a23f413-6dad-4013-8729-4a3482b9ee93

📥 Commits

Reviewing files that changed from the base of the PR and between ce23e1a and 415cd67.

📒 Files selected for processing (3)
  • docs/nuxt/Dockerfile
  • docs/nuxt/scripts/serve.js
  • docs/nuxt/test/unit/serve.test.js

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Nuxt static server now loads druxtjs.org redirect rules from an nginx map, applies matching 301 redirects before slash handling, preserves queries, and receives the map in the Docker runtime image. Tests cover parsing, loading, matching, and missing maps.

Changes

Legacy redirect handling

Layer / File(s) Summary
Redirect-map parsing and loading
docs/nuxt/scripts/serve.js, docs/nuxt/test/unit/serve.test.js
Adds redirect-map discovery, parsing, loading helpers, and tests for relative targets.
Runtime redirect application
docs/nuxt/scripts/serve.js, docs/nuxt/test/unit/serve.test.js
Applies matching legacy redirects as 301 responses before trailing-slash handling. Preserves query strings and tests anchored matching, repository mappings, and missing maps.
Runtime map availability
docs/nuxt/Dockerfile
Copies .lagoon/redirects-map.conf into the final image for the static server.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 415cd

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
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: serving legacy druxtjs.org redirects from the application instead of nginx.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/docs-legacy-redirects

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.79%. Comparing base (ce23e1a) to head (415cd67).

Additional details and impacted files

Impacted file tree graph

@@           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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Decipher

Decipher commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Decipher
Decipher merged commit 3768a65 into develop Sep 6, 2026
14 checks passed
@Decipher
Decipher deleted the feature/docs-legacy-redirects branch September 6, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant