Ir al contenido
Español

SecurityHeadersOptionsType

Esta página aún no está disponible en tu idioma.

SecurityHeadersOptionsType = object

Defined in: src/http/middleware/SecurityHeadersOptions.ts:15

Plain settings shape for the security-headers bundle.

readonly optional contentTypeOptions?: boolean

Defined in: src/http/middleware/SecurityHeadersOptions.ts:32

X-Content-Type-Options: nosniff. Default true.

false is honoured server-wide onlynewServerAt(…).withSecurityHeaders({ contentTypeOptions: false }) replaces the backend’s default header map, so the header stops being written. On the securityHeaders() middleware it has no visible effect: since #127 every backend writes nosniff ahead of every response it emits, and a middleware can only add headers, never take one away. So the response still carries it (#1060).

There is no route to “nosniff off for this subtree” — deliberately. The header is per-response and the backend’s copy is the last word, which is the point of putting it there: the backend’s own 404, its body-parse 413 and every error short-circuit never pass through a middleware at all.


readonly optional crossOriginEmbedderPolicy?: "require-corp" | "credentialless" | false

Defined in: src/http/middleware/SecurityHeadersOptions.ts:44

Cross-Origin-Embedder-Policy. Default false (breaks embeds; opt-in).


readonly optional crossOriginOpenerPolicy?: "same-origin" | "same-origin-allow-popups" | "unsafe-none" | false

Defined in: src/http/middleware/SecurityHeadersOptions.ts:40

Cross-Origin-Opener-Policy. Default 'same-origin'; false omits it.


readonly optional crossOriginResourcePolicy?: "same-origin" | "same-site" | "cross-origin" | false

Defined in: src/http/middleware/SecurityHeadersOptions.ts:42

Cross-Origin-Resource-Policy. Default 'same-origin'; false omits it.


readonly optional frameOptions?: "DENY" | "SAMEORIGIN" | false

Defined in: src/http/middleware/SecurityHeadersOptions.ts:34

X-Frame-Options. Default 'DENY'; false omits it.


readonly optional hsts?: Partial<HstsOptionsType> | false

Defined in: src/http/middleware/SecurityHeadersOptions.ts:48

Also emit HSTS with these options. Default false (opt-in — see strictTransportSecurity).


readonly optional permissionsPolicy?: Readonly<Record<string, readonly string[]>> | false

Defined in: src/http/middleware/SecurityHeadersOptions.ts:38

Permissions-Policy as feature→allowlist. Default false (omitted).


readonly optional referrerPolicy?: string | false

Defined in: src/http/middleware/SecurityHeadersOptions.ts:36

Referrer-Policy. Default 'no-referrer'; false omits it.


readonly optional xssProtection?: boolean

Defined in: src/http/middleware/SecurityHeadersOptions.ts:46

X-XSS-Protection: 0 (disable the buggy legacy filter). Default true.