❤️
SecurityHeaders.nl

HTTP Security Headers Guide

HTTP security headers are a critical part of securing your web application. They allow the server to instruct the web browser on how to behave, preventing a wide range of vulnerabilities, including Cross-Site Scripting (XSS), clickjacking, and data injection attacks.

Below is a complete guide to the essential security headers you should configure on your website.

Content-Security-Policy (CSP)

The most powerful security header. CSP prevents XSS and data injection by restricting where resources (scripts, styles, images) can be loaded from and executed.

Read more

HTTP Strict Transport Security (HSTS)

HSTS forces browsers to communicate with your server over HTTPS only, preventing SSL stripping and downgrade attacks.

Read more

X-Frame-Options

Prevents clickjacking attacks by ensuring your content cannot be embedded into iframes on malicious third-party sites.

Read more

X-Content-Type-Options

Stops browsers from attempting to MIME-sniff the content type, forcing them to stick with the declared Content-Type.

Read more

Referrer-Policy

Controls how much referrer information (the URL the user came from) is included with requests made to external sites.

Read more

Permissions-Policy

Allows you to enable or disable specific browser features (like the camera, microphone, or geolocation) in its own frame and iframes.

Read more

Cross-Origin-Embedder-Policy (COEP)

Prevents a document from loading cross-origin resources without explicit CORP authorization, stopping Spectre side-channel attacks.

Read more

Cross-Origin-Opener-Policy (COOP)

Isolates top-level browsing contexts from cross-origin windows, neutralizing window.opener and tabnabbing exploits.

Read more

Cross-Origin-Resource-Policy (CORP)

Instructs browsers to block unauthorized cross-origin embedding of your static images, scripts, audio, and private APIs.

Read more

Cache-Control

Controls how and when responses are cached by the browser and intermediaries. Crucial for protecting sensitive data from being cached on shared systems.

Read more

Clear-Site-Data

Wipes browsing data (cookies, storage, cache) tied to the requesting website. Use with caution, usually on logout endpoints.

Read more

Supports-Loading-Mode

An emerging header that indicates support for fenced frames, which provide a strict privacy boundary around embedded content.

Read more

Speculation-Rules

Delivers speculation rules to the browser to improve performance (e.g., prefetching/prerendering) securely via HTTP headers.

Read more