TR EN

6 critical HTTP security headers for your website

A few lines of server configuration make your site far more resilient to many common attacks.

HTTP security headers are small instructions that tell the browser how your site should behave. They are added through server configuration alone, without code changes, and they make many common attacks harder. We use all of the headers below on our own site.

1. Strict-Transport-Security (HSTS)

Tells the browser to connect to your site only over HTTPS and prevents downgrade to an unencrypted connection. Example: max-age=31536000.

2. Content-Security-Policy (CSP)

Restricts the sources a page can load scripts, styles, images and frames from. A well-configured CSP is one of the most effective layers of defence against cross-site scripting (XSS).

3. X-Content-Type-Options

The nosniff value stops the browser from guessing file types and prevents files served with the wrong type from being executed as scripts.

4. X-Frame-Options / frame-ancestors

Prevents your site from being shown inside a hidden frame on another site, blocking clickjacking attacks.

5. Referrer-Policy

Controls how much of the address is shared when a user moves to another site. strict-origin-when-cross-origin is a balanced default.

6. Permissions-Policy

Limits who can access browser features such as the camera, microphone and location. Turning off features you do not use is recommended.

Test your site

Free tools such as securityheaders.com show your site’s current state in seconds. For a broader external assessment, use our free initial scan.

All articles Free Initial Scan
Under attack?