Payload's colour-scheme client hints go to the admin only: withSecurityConfig outside withPayload

withPayload adds Accept-CH, Critical-CH and Vary: Sec-CH-Prefers-Color-Scheme for /:path*; Critical-CH makes
Chrome repeat the first document request of a visit to a public page. As the outer wrapper, withSecurityConfig
moves the three headers to /admin/:path* (adminClientHints: { route, sources } | false). Inside withPayload
nothing changes, so an unedited site behaves as before. Exports scopeColorSchemeClientHints,
adminClientHintSources, COLOR_SCHEME_CLIENT_HINT; doctor rule client-hints (info); reference site and starter
use the new order; e2e:built and the starter gate check it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 11:55:26 +01:00
co-authored by Claude Fable 5.2
parent 2f6a81acbf
commit 9143c132a3
28 changed files with 500 additions and 59 deletions
+3
View File
@@ -413,6 +413,7 @@ export {
} from './modules/secrets/writeOnly.js'
export type { WriteOnlySecretOptions } from './modules/secrets/writeOnly.js'
export {
adminClientHintSources,
buildAdminCsp,
buildAdminCspHeaders,
buildCsp,
@@ -420,12 +421,14 @@ export {
buildReportingEndpoints,
buildSecurityHeaders,
buildUploadSecurityHeaders,
COLOR_SCHEME_CLIENT_HINT,
createCspNonce,
createCspReportRoute,
CSP_NONCE_HEADER,
cspHeaderKey,
DEFAULT_CSP_REPORT_GROUP,
parseCspReports,
scopeColorSchemeClientHints,
totpAdminPath,
totpRedirectTarget,
UPLOAD_SECURITY_HEADERS,