fix(docs): serve the home page at / on the node-server output (UXF-286) - #336
Open
alexgrozav wants to merge 1 commit into
Open
alexgrozav wants to merge 1 commit into
alexgrozav wants to merge 1 commit into
Conversation
The layer's llms-redirect plugin 302s the site root to /llms.txt for `Accept: text/markdown` and for `curl/*` user agents. It never fires on our Vercel deploy, where the CDN serves the prerendered index.html before Nitro sees the request, so the node-server output disagreed with the live site on the site root — and `curl -I` on a local production check reported the home page as broken. Disable it via nitro.ignore and guard the route with a build test that boots the compiled server. Reading .output/public cannot catch this: the redirect lives in a request hook that runs ahead of the public-asset handler, and prerendering writes a correct index.html either way. /llms.txt and /llms-full.txt are unchanged.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This branch was successfully 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.
Description
The
apps/docsNode server answered/with a302to/llms.txt. The cause is not a route rule — it isserver/plugins/llms-redirect.tsin@uxfront/layer-docs@0.4.1, a Nitrorequest-hook plugin that redirects the site root when the client sendsAccept: text/markdownor acurl/*user agent.Two problems with keeping it on:
index.htmlfrom the CDN, so Nitro never sees/. Verified —curl -H 'accept: text/markdown' https://www.styleframe.dev/returns200 text/html. The plugin only fires on the node-server preset, so the build output disagreed with the live site on the site root: exactly the route a self-hosted deploy or a local production check hits first.curl/*branch is not content negotiation.curlis what humans, health checks, uptime monitors and CI smoke tests speak HTTP with.curl -I http://localhost:3000/returning a redirect to a text file is how this was reported as a broken home page.This disables the plugin from
apps/docswithnitro.ignore./llms.txtand/llms-full.txtare still generated and served; agents reach them through thellms.txtconvention.Upstream follow-up: the durable fix is dropping the user-agent branch in
@uxfront/layer-docs. Thenuxt.config.tscomment says so, and the guard below will keep this honest until then.The test
test/root-route.build.test.tsboots the compiled.output/server/index.mjson an OS-assigned port and asserts/returns200 text/htmlfor a browser UA, forcurl/8.7.1, and forAccept: text/markdown— plus that/llms.txtstill serves.It has to boot the real server. The redirect lives in a
requesthook that runs ahead of Nitro's public-asset handler, so reading.output/public(what the other build guards do) cannot see it, andnuxt devnever exercises the compiled plugin list. It runs in the existingtest:buildsuite, against the artifact the docs build job just produced.Verification
Against the built Node server, before the change:
After, on a forced rebuild:
pnpm test:build8 passed ·pnpm test4 passed ·pnpm typecheckexit 0 ·oxlint/oxfmtclean.Related issue
Relates to UXF-286.
Type of change
Checklist
feat(theme): …)pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm testand everything passespnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/testsdist/,.styleframe/)mainand stays focused in scopeNotes / screenshots
@styleframe/docsis in the changesetsignorelist, so no changeset applies.No visual change: browsers were already served the correct home page, which is why this survived to a
0.3.0baseline unnoticed.