Skip to content

fix: resolve legacy redirects on client-side navigation - #824

Draft
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787308668-client-side-redirects
Draft

fix: resolve legacy redirects on client-side navigation#824
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787308668-client-side-redirects

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Navigating to an old (redirected) URL through in-app navigation — e.g. selecting a stale Algolia search result like /docs/theoplayer/how-to-guides/cast/chromecast/sending-messages-from-to-sender-to-from-receiver/ — showed "Page Not Found", while a full page refresh worked. That's because @docusaurus/plugin-client-redirects only emits static redirect HTML pages, which SPA (client-side) navigation never loads.

This adds a NotFound/Content theme wrapper that resolves the same redirect rules client-side: when a route 404s, it looks the path up in redirectsMillicast.json / redirectsAds.json / redirectsTHEOPlayer.json plus the inverse of the createRedirects rules from docusaurus.config.ts, and issues a router <Redirect> to the new path (preserving query and hash). Unknown paths still render the normal Not Found page.

Note: NotFound/Content (not the top-level NotFound page) is wrapped because doc-path 404s are rendered through the docs plugin's fallback, which uses NotFound/Content directly.

Verified locally: old Chromecast guide URLs now land on the web/cast/chromecast/... pages via SPA navigation, and a genuinely unknown URL still shows Page Not Found.

Link to Devin session: https://dolby.devinenterprise.com/sessions/3bdada042aef4c64b0f981ba4dc3a620

The client-redirects plugin only emits static redirect pages, which are
bypassed by SPA navigation (e.g. stale Algolia search results). Wrap
NotFound/Content to resolve the same redirect rules client-side.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Tested this end-to-end on the local dev server (npm start, http://localhost:3000/docs/). All flows work:

  • SPA navigation: clicking a stale Algolia search result for the old /how-to-guides/cast/chromecast/sending-messages-... path now lands on the new /web/cast/chromecast/... page with content (previously "Page Not Found" until refresh)
  • ✅ Direct loads of old URLs redirect: /millicast/web-cameras//millicast/capture/web-cameras/, /theoads/api//ads/api/, /theoplayer/how-to-guides/miscellaneous/verizon-media/preplay//web/uplynk/preplay/, /theolive/api/events/get-event//theolive/v1/api/events/get-event/
  • ✅ Query string + hash preserved across redirect (?foo=bar#connecting-a-web-camera-to-obs)
  • ✅ Unknown URLs (/docs/nonexistent-page-xyz/) still show Page Not Found — no redirect loop
  • ✅ Normal existing pages unaffected

SPA redirect landed on new chromecast page

More evidence

theolive v1 redirect
unknown URL still 404s

Minor edge case noted: an old /theolive/api/<slug>/ whose slug doesn't exist in v1 (e.g. /theolive/api/get-event/ — real path includes events/) gets rewritten to the (nonexistent) v1 URL and shows Page Not Found there. No loop, but the URL shown to the user is the rewritten one rather than the original.

Written by Devin

@theoplayer-bot

Copy link
Copy Markdown
Contributor
Documentation preview
🚀 View preview at
https://docs-preview.optiview.dolby.com/pr-824/

Deployed from commit a9eff71 at 2026-08-21 10:45 UTC.

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