Content Validation
PRISM includes a content quality gate that validates rendered HTML before caching and serving it. This prevents broken or empty pages from being indexed by search engines.
Configuration
[render.content_validation]
enabled = true
min_text_length = 100
require_title = true
min_html_bytes = 1024
Validation Checks
min_html_bytes
The total size of the rendered HTML in bytes. If the output is smaller than this threshold, validation fails. This catches cases where Chrome returned an error page or the SPA failed to render.
Default: 1024 bytes
min_text_length
The number of visible text characters after stripping all HTML tags. This ensures the page has meaningful content, not just an empty shell with markup.
Default: 100 characters
require_title
When enabled, PRISM checks that the rendered HTML contains a non-empty <title> tag. Pages without titles are a strong signal that the SPA did not finish rendering.
Default: true
What Is Checked
The gate asks whether the application finished rendering a page. It applies to responses with a status below 400 that are not redirects.
It does not apply to:
- Redirects. A redirect has no body worth measuring.
- Error statuses (400 and above). A
404,410or500is the origin's answer, not a failed render, and error pages are routinely a few hundred bytes. Before 1.4.7 the gate was applied to them: a short404failed it, and a crawler was told503— to keep coming back — for a page the origin had said was gone. The status used is the final one, after anystatus_from_metaoverride, so a single-page application's own "not found" view is exempt as well.
An error status with no body at all never reaches the gate: Chrome reports
that navigation as failed. PRISM passes the origin's response through
unchanged, exactly as it does for a non-HTML document
(x-prism-fallback: not-html).
A document that has left the site is handled the same way. If the page's own
JavaScript sent the browser to another origin, nothing is validated or stored
and the crawler receives the origin's own response with
x-prism-fallback: left-origin; see
Is it still the site's page?.
What Happens on Failure
When content validation fails:
- The rendered HTML is discarded (not cached, not served).
- What the client receives depends on who it is:
- A bot receives
503withRetry-After: 30andx-prism-fallback: render-failed. It is deliberately not given the origin's unrendered page: a crawler would index the empty shell. - A visitor (
render-allmode) receives the origin's own response, proxied directly, withx-prism-fallback: true. Their browser can run the application.
- A bot receives
- The circuit breaker is not tripped. Content validation failures are treated as soft failures because the Chrome render itself succeeded; the output simply did not meet quality standards.
- A warning is logged with the failure reason.
- The
content_validation_failuresmetric counter is incremented.
During a background refresh of a stale entry, a failed validation keeps the
existing entry instead of replacing it. So does a 5xx from the origin: a good
copy still inside its grace window is served in preference to the error.
A page that fails validation on every render is therefore 503 to crawlers
until it is fixed. Watch content_validation_failures, and lower the
thresholds for pages that are legitimately small.
When to Enable
Enable content validation (the default) when:
- You are running in
bot-onlymode and want to ensure bots always see quality content. - Your SPA occasionally fails to load data, resulting in empty shells.
- You want to catch rendering regressions before they affect SEO.
When to Disable
Disable content validation when:
- You are running in
render-allmode and serving all visitors. In this mode, you may prefer to serve whatever Chrome rendered rather than falling back to the unrendered SPA. - Your pages legitimately have very little text content (e.g., image galleries, video pages).
- You have pages without
<title>tags by design.
[render.content_validation]
enabled = false
Tuning Thresholds
For SPAs with short pages, lower the thresholds:
[render.content_validation]
enabled = true
min_text_length = 50 # Short product descriptions
require_title = true
min_html_bytes = 512 # Smaller pages
For content-heavy sites, raise them:
[render.content_validation]
enabled = true
min_text_length = 500 # Ensure full article body rendered
require_title = true
min_html_bytes = 4096 # Larger pages expected