AI Focus

crawler ssr vs. spa visibility

Why this matters

Non-rendering HTTP crawlers (ClaudeBot, GPTBot, CCBot) read raw wire HTML without executing client-side JavaScript. When a page ships an empty SPA shell (<div id="root"></div>) and populates prose only after scripts run, those crawlers record zero visible words—leaving the page invisible in training snapshots and non-rendering retrieval pipelines.

What this opens up

Exposing JS-only crawler blind spots before a page ships. Teams can inspect raw non-JS HTML side by side with a live browser render, audit any public HTTPS URL behind an SSRF guard, and catch false positives where naive regexes misclassify streaming SSR pages as empty shells.

How the tests work

  1. Click Audit Empty SPA Shell vs. Audit Pure SSR to compare 0 raw wire words inside #root against ~190 rendered browser words in the side-by-side preview iframe.
  2. Run Trigger Streaming Falsification (/fixtures/streaming-falsify) to inspect how an empty #root paired with deferred <template hidden> prose and React Flight payloads fools naive regex shell detectors.
  3. Switch to Public HTTPS URL to fire blocked SSRF probes (169.254.169.254, 127.0.0.1, [::1], http://) and audit a real public HTTPS page, or switch to Paste Raw HTML to test local snippets with X-Robots-Tag and Content-Usage headers.
  4. Run Matrix All 4 Fixtures to compare wire bytes, visible words, <template> words, hydration payload bytes, and verdicts in one table.
SSRF-hardened streaming HTMLRewriter auditor comparing raw non-JS crawler extraction against live browser rendering across SSR, Hydration-Heavy, Empty SPA, and Streaming-Falsify fixtures, public HTTPS URLs, and pasted HTML. Open crawler ssr vs. spa visibility full screen ↗

Hypothesis

Fetching raw wire HTML without executing JavaScript and parsing it with streaming HTMLRewriter for empty application mounts (#root, #app, #__next, <app-root>) plus visible body word count accurately predicts non-rendering crawler blindness.

What confirms it: Auditing /fixtures/empty-spa against /fixtures/ssr records 0 visible non-JS wire words inside <div id="root"></div> while the rendered browser iframe displays ~190 words after /fixtures/empty-spa.js runs—mirroring empirical findings in URLs in Models (6% bare-URL recall on 31 client-rendered pages vs. 55% on 60 server-rendered sources; 0.45% empty-mount floor across 1.04M Common Crawl pages, rising to 2.5%–2.8% among top-10k domains).

What bounds or disproves it: /fixtures/streaming-falsify pairs an empty #root mount with deferred server-rendered prose inside <template hidden> and serialized React Flight / __NEXT_DATA__ payloads—causing naive empty-mount regexes to emit false-positive SPA shell verdicts and naive tag-strippers to count JSON keys as visible prose.

Under the hood

Crawler SSR vs. SPA Visibility (GitHub) runs a Cloudflare Worker with two core modules: an SSRF-hardened fetcher (src/ssrf.ts) and a streaming HTML auditor (src/auditor.ts). Before any remote request leaves the edge, src/ssrf.ts enforces https:// on port 443, rejects private RFC 1918, loopback, CGNAT, link-local, metadata (169.254.169.254), and IPv6 literals, validates every redirect: "manual" hop, and caps wire reads at 512 KiB and 8 seconds.

src/auditor.ts streams raw wire bytes through Cloudflare HTMLRewriter (with a parity state-machine fallback in Node unit tests) to separate visible body text from <script>, <style>, <svg>, <noscript>, and <template>/[hidden] regions, quantify hydration payload bytes, detect empty SPA mounts, and compare naive regex detection against streaming-aware classification. The Worker also hosts four live fixtures (/fixtures/ssr, /fixtures/hydration-heavy, /fixtures/empty-spa, /fixtures/streaming-falsify) so the workbench can audit the raw response while rendering the exact same URL inside a sandboxed same-origin iframe.

Key terms & further reading

SSR vs. CSR (Server-Side vs. Client-Side Rendering) ↗
SSR sends finished HTML prose in the initial HTTP response; CSR sends a minimal shell and builds visible text in the browser with JavaScript.
Empty SPA shell ↗
A single-page app response containing only an empty mount node such as <div id="root"></div> until client scripts execute.
Cloudflare HTMLRewriter ↗
A streaming edge HTML parser that inspects tags and text chunks directly on the wire without executing JavaScript.
Hydration & React Flight payloads ↗
Serialized state blobs (__NEXT_DATA__, __NUXT__, self.__next_f.push) embedded inside <script> tags so client code can attach interactivity.
SSRF (Server-Side Request Forgery) guard ↗
URL and redirect validation that blocks server-side fetchers from reaching loopback, RFC 1918, CGNAT, or cloud metadata addresses.
X-Robots-Tag & IETF aipref (Content-Usage) ↗
HTTP response headers communicating indexing and AI training preferences to automated crawlers.

Open questions

  • How accurately can streaming HTML parsers separate real server-rendered streaming <template> chunks from hidden metadata or unused hydration JSON?
  • When a site cannot rewrite its SPA shell immediately, does Accept: text/markdown content negotiation close the crawler visibility gap without duplicating URLs?

Iteration log

  • — Deployed SSRF-hardened Cloudflare Worker (POST /api/audit-url, /api/audit-fixture, /api/analyze-html) running streaming HTMLRewriter across four fixtures (SSR Content-Rich, Hydration-Heavy RSC/JSON, Empty Client SPA Shell, Streaming/Deferred Ambiguous) with live side-by-side raw crawler vs. browser iframe previews.

Primitives tested: Cloudflare HTMLRewriter, Non-JS HTTP Crawler Audit, SSRF-Hardened Fetcher, DOM vs. Wire Word Diff.

This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.

More in crawler visibility, model cutoffs & quality evals

Connected labs

← crawler visibility, model cutoffs & quality evals · All labs