fix(server): noindex the app shell and serve a real robots.txt#3336
fix(server): noindex the app shell and serve a real robots.txt#3336nachocossio wants to merge 1 commit into
Conversation
app.mcpjam.com's SPA catch-all returned index.html with a 200 for every path, including /robots.txt — crawlers got unparseable HTML, which reads as allow-all, leaving the authenticated app shell fully indexable. Policy: allow crawling + X-Robots-Tag: noindex on every response (via the existing securityHeadersMiddleware), so robots can actually see the directive; a Disallow would blind them to it and risk link-only indexing. client/public/robots.txt rides the same pipeline as the favicon into dist/client, where serveStatic wins over the catch-all. Refs ARM-16
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughAdded crawler rules for the app shell and configured the security middleware to emit Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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 |
Internal previewPreview URL: https://mcp-inspector-pr-3336.up.railway.app |
Problem
app.mcpjam.com's SPA catch-all returnsindex.htmlwith a200for every path — including/robots.txt. Crawlers requesting it get unparseable HTML, which robots parsers treat as allow-all, so the authenticated app shell is fully crawlable and indexable (robots.txt is per-host; the marketing site's file doesn't cover this origin).Verified on prod before the fix:
No
X-Robots-Tagor<meta robots>anywhere.Fix — policy: allow crawling + noindex
client/public/robots.txt(new): valid, parseable robots.txt that allows crawling. It rides the same VitepublicDirpipeline as the favicon intodist/client/, whereserveStatic(server/index.ts:563) wins over the SPA catch-all (:566).X-Robots-Tag: noindexon every response, added to the existingsecurityHeadersMiddleware(applies globally in bothserver/index.tsand theserver/app.tsmirror).Why not
Disallow: /: a Disallow blinds robots to the noindex directive — Google can still index the URLs from external links (ugly, empty results). Allow + noindex is the reliable way to keep the shell out of search indexes. AI agents are unaffected (noindexonly governs search indexing, not fetching).Tests
Red→green: new
server/middleware/__tests__/security-headers.test.ts(mirrors the existing middleware test style) — baseline case for the 4 existing headers passed against the old code, the 2X-Robots-Tagcases failed (Received: null), all 3 pass with the change.Refs ARM-16 (Agent Readiness board).
Summary by cubic
Serve a real robots.txt and add a global X-Robots-Tag: noindex to keep the authenticated app shell off search results while still allowing crawlers to fetch pages. Addresses ARM-16.
client/public/robots.txtso/robots.txtreturns a valid file withAllow: /.X-Robots-Tag: noindexinsecurityHeadersMiddlewarefor all routes (HTML and API).X-Robots-Tag.Written for commit cd4fb05. Summary will update on new commits.