Bỏ qua đến nội dung chính
TOP free online tools Bàn làm việc của bạn
Tiếng Việt
Tham chiếu Cập nhật lần cuối: 2026-11-23

Bảng Tham Chiếu Header Bảo Mật HTTP

Tài liệu tham chiếu đầy đủ về các header bảo mật HTTP, CORS, cookie và cache kèm giá trị khuyến nghị cho môi trường thực tế và mức độ tác động.

Click any cell to copy
22 / 22
HeaderPurposeRecommended ValueSecurity Impact
Strict-Transport-SecurityEnforces HTTPS connections and prevents protocol downgrade attacksmax-age=31536000; includeSubDomains; preloadHigh — blocks SSL stripping and plaintext HTTP fallback across subdomains
Content-Security-PolicyRestricts allowed origins for scripts, styles, frames, images, and network requestsdefault-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'Critical — primary browser defense against XSS, script injection, and clickjacking
Content-Security-Policy-Report-OnlyTests strict CSP rules in production and reports violations without blocking resourcesdefault-src 'self'; report-to csp-endpointMedium — enables zero-downtime CSP rollout before enforcement
X-Content-Type-OptionsPrevents browsers from MIME-sniffing responses away from declared Content-TypenosniffHigh — stops uploaded text or JSON files from executing as scripts or HTML
X-Frame-OptionsControls whether the document may be embedded inside iframe, frame, or object tagsDENY (or SAMEORIGIN if embedded internally)High — legacy defense against UI redressing and clickjacking attacks
Referrer-PolicyControls how much URL path and origin information is sent in the Referer headerstrict-origin-when-cross-originMedium — prevents token or private path leakage to third-party origins
Permissions-PolicyDisables or scopes sensitive browser APIs like camera, microphone, geolocation, and USBcamera=(), microphone=(), geolocation=(), payment=()Medium — limits blast radius if third-party embeds or scripts run on page
Set-Cookie (Session)Transports authentication cookies safely with JS isolation and transport flags__Host-sid=token; Path=/; Secure; HttpOnly; SameSite=LaxCritical — mitigates cookie theft via XSS, MitM, and cross-site CSRF
Cross-Origin-Opener-PolicyIsolates the top-level browsing context from cross-origin popups and openerssame-originHigh — protects against Spectre-class cross-origin memory leaks (enables COOP/COEP)
Cross-Origin-Embedder-PolicyRequires subresources to opt in explicitly via CORS or CORP before loadingrequire-corp (or credentialless)Medium — pairs with COOP for cross-origin isolation and SharedArrayBuffer
Cross-Origin-Resource-PolicyBlocks unauthorized cross-origin reads of static images, scripts, and JSON assetssame-origin (or same-site)Medium — prevents speculative side-channel reads across origins
Access-Control-Allow-OriginSpecifies which origin is permitted to read CORS responses via fetch/XHRhttps://app.example.com (avoid * with credentials)High — misconfigured origin reflection leaks private authenticated responses
Access-Control-Allow-CredentialsAllows browsers to expose responses when cookies or Authorization headers are senttrue (only with explicit origin allowlist)High — never combine with wildcard or untrusted Origin echoing
VaryInstructs shared caches and CDNs which request headers alter the responseOrigin, Accept-EncodingMedium — prevents cross-origin CORS cache poisoning on edge CDNs
Cache-Control (Private API)Prevents proxies and shared browsers from storing personalized or sensitive responsesno-store, max-age=0High — stops sensitive user data from lingering in shared browser or CDN caches
Cache-Control (Static Assets)Caches versioned bundles or semi-static feeds cleanly with background revalidationpublic, max-age=3600, stale-while-revalidate=86400Low — optimizes edge performance without leaking private state
Clear-Site-DataInstructs the browser to wipe cookies, storage, and cache on logout"cache", "cookies", "storage"Medium — guarantees complete client session teardown after sign-out
X-DNS-Prefetch-ControlDisables speculative DNS lookups for external links embedded in user contentoffLow — reduces passive tracking and internal hostname leakage
X-Permitted-Cross-Domain-PoliciesBlocks legacy cross-domain policy files used by Flash or PDF embedsnoneLow — hardens legacy plugin cross-domain read vectors
Reporting-EndpointsDefines named HTTPS endpoints for CSP, COOP, and deprecation violation reportscsp-endpoint="https://example.com/reports"Medium — provides real-time telemetry on browser policy violations
Server / X-Powered-ByLegacy banner headers that advertise exact framework and runtime versionsStrip or minimize (omit X-Powered-By)Low — reduces automated fingerprinting noise in vulnerability scans
Content-Type (Charset)Explicitly declares media type and UTF-8 character encoding on API responsesapplication/json; charset=utf-8Medium — prevents charset-confusion XSS in older browsers and parsers

Công cụ liên quan

Hướng dẫn liên quan

Tài liệu liên quan

Câu hỏi thường gặp

Which HTTP security headers provide the strongest baseline defense?
Strict-Transport-Security (HSTS) enforces HTTPS, Content-Security-Policy (CSP) mitigates XSS and script injection, X-Content-Type-Options: nosniff blocks MIME sniffing, and X-Frame-Options or CSP frame-ancestors prevents clickjacking.
What flags should protect session cookies in Set-Cookie?
Session cookies should include HttpOnly to block JavaScript access, Secure to require HTTPS transport, SameSite=Lax or Strict to mitigate CSRF, and the __Host- prefix with Path=/ to bind the cookie to the exact origin.
Why should Vary: Origin be paired with dynamic CORS headers?
When Access-Control-Allow-Origin returns a specific allowed origin rather than *, Vary: Origin instructs CDNs and shared proxies to key cached responses by Origin, preventing cross-origin CORS cache poisoning.