Skip to content

docs(static-sites): document gateway response headers#52

Merged
acoshift merged 1 commit into
mainfrom
docs-static-response-headers
Jun 27, 2026
Merged

docs(static-sites): document gateway response headers#52
acoshift merged 1 commit into
mainfrom
docs-static-response-headers

Conversation

@acoshift

Copy link
Copy Markdown
Member

What

Adds a Response headers section to content/deployments/static-sites.md documenting the fixed headers the static gateway stamps on responses it serves, and cross-links the existing Preview deployments mention to it.

The page already mentioned X-Robots-Tag: noindex in passing (in the preview prose), but never documented the actual rule or the always-on security headers. The mechanism only lived in static-gateway code comments.

What's documented

Header Value Set on
X-Content-Type-Options nosniff every served response
X-Frame-Options DENY every served response
X-Robots-Tag noindex HTML responses of preview releases only

Plus the exact noindex rule and how the environment is chosen:

  • Set only when the response is HTML (incl. the built-in 404 page) and the release's environment is not production.
  • A production release carries no X-Robots-Tag and is indexable; any other environment value (pr-<n>, preview, …) is served noindex. Non-HTML assets never get it.
  • Environment defaults to production: a push to the default branch (GitHub action) and deploys site deploy → indexable; a PR deployment and deploys site previewnoindex.

Verification

Documented behavior was traced against the source and matches:

  • static-gateway/internal/server/server.gosetSecurityHeaders (nosniff/DENY unconditional; noindex gated on isHTML && !IsProduction), isHTML = Content-Type prefix text/html, built-in 404 passes isHTML=true.
  • static-gateway/internal/manifest/manifest.goIsProduction is an exact "production" match.
  • api/client/site.go — empty environment normalizes to production at publish.
  • deploys/internal/runner/site.gosite publish/site deploy default environment to production; site preview defaults to a non-production (noindex) environment.

The "every served response" wording is deliberate: the security headers are set inside the file-serving and 404 paths, not on the gateway's own request-error responses (malformed path, unknown release, wrong method, internal error).

hugo --gc builds clean; the #response-headers anchor and cross-links render correctly.

Scope

Docs-only. No code, schema, or behavior change.

Add a "Response headers" section to the Static sites page covering the
fixed headers the static gateway sets — X-Content-Type-Options,
X-Frame-Options, and the X-Robots-Tag: noindex preview rule — including
the exact production-vs-preview environment behavior and the CLI/GitHub
defaults that drive it. Cross-link the existing Preview deployments
mention to it.
@deploys-app deploys-app Bot temporarily deployed to pr-52 June 27, 2026 03:24 Destroyed
@deploys-app

deploys-app Bot commented Jun 27, 2026

Copy link
Copy Markdown

Preview deleted (PR closed).

@acoshift acoshift merged commit 54e127f into main Jun 27, 2026
1 check passed
@acoshift acoshift deleted the docs-static-response-headers branch June 27, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant