fix: RSS button 500 by bypassing client-side navigation#185
Closed
dobby-coder[bot] wants to merge 1 commit into
Closed
fix: RSS button 500 by bypassing client-side navigation#185dobby-coder[bot] wants to merge 1 commit into
dobby-coder[bot] wants to merge 1 commit into
Conversation
Closes #183 The blog RSS button used a SvelteKit anchor with no reload hint. The (marketing) layout sets trailingSlash: 'always', which causes the client router to redirect /blog/rss.xml to /blog/rss.xml/ on client-side navigation. The +server.js endpoint is prerendered to a file at /blog/rss.xml, so the trailing-slash form falls through to the SPA shell (or errors), and visitors saw a 500. Adding data-sveltekit-reload makes the browser perform a full navigation, bypassing the client router so the static file is served directly. Direct URLs already worked because they are not subject to the router's trailing-slash rewrite.
Contributor
Author
|
Superseded by #202 (consolidation per encryption4all/dobby#53). Closing to keep the queue tidy. |
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.
Closes #183
Cause
The blog page's RSS button used a SvelteKit anchor with
href={resolve('/(marketing)/blog/rss.xml')}and no reload hint. The(marketing)layout setstrailingSlash: 'always', so the client-side router redirects/blog/rss.xmlto/blog/rss.xml/on navigation. The+server.jsendpoint is prerendered to a file at/blog/rss.xml, so the trailing-slash form falls off the static file map and visitors saw a 500.Direct URL access (
staging.postguard.eu/blog/rss.xml) worked because it isn't subject to the router's trailing-slash rewrite — nginx serves the file directly.Fix
Add
data-sveltekit-reloadto the anchor so the browser does a full navigation, bypassing the client router for this link only. The<link rel=\"alternate\">in<svelte:head>already used a plain href and is not affected.Verification
npm run buildsucceeds; builtbuild/blog/index.htmlnow containsdata-sveltekit-reload=\"\"on the RSS anchor.npx prettier --checkandnpx svelte-check --threshold warningboth clean.curl -I https://staging.postguard.eu/blog/rss.xmlreturns 200 +content-type: text/xml;/blog/rss.xml/(the trailing-slash form the router was producing) returns the SPA shell, confirming the route mismatch.Reviewer quickstart
```
git fetch origin && git checkout fix/rss-button-500 && npm ci --legacy-peer-deps && npm run dev
```
Then open the blog index and click the RSS button — should now load the XML feed directly without a round trip through the SPA router.