docs(static-sites): document gateway response headers#52
Merged
Conversation
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.
|
Preview deleted (PR closed). |
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.
What
Adds a Response headers section to
content/deployments/static-sites.mddocumenting 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: noindexin 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
X-Content-Type-OptionsnosniffX-Frame-OptionsDENYX-Robots-TagnoindexPlus the exact
noindexrule and how the environment is chosen:production.productionrelease carries noX-Robots-Tagand is indexable; any other environment value (pr-<n>,preview, …) is servednoindex. Non-HTML assets never get it.production: a push to the default branch (GitHub action) anddeploys site deploy→ indexable; a PR deployment anddeploys site preview→noindex.Verification
Documented behavior was traced against the source and matches:
static-gateway/internal/server/server.go—setSecurityHeaders(nosniff/DENYunconditional;noindexgated onisHTML && !IsProduction),isHTML=Content-Typeprefixtext/html, built-in 404 passesisHTML=true.static-gateway/internal/manifest/manifest.go—IsProductionis an exact"production"match.api/client/site.go— empty environment normalizes toproductionat publish.deploys/internal/runner/site.go—site publish/site deploydefault environment to production;site previewdefaults 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 --gcbuilds clean; the#response-headersanchor and cross-links render correctly.Scope
Docs-only. No code, schema, or behavior change.