SecHead
Scansiona un sitoContattaci
Pillar Guide14 min read

The Complete Security Headers Checklist (2026)

Every HTTP security header your site should have, what each one does, and the exact values to use. The definitive reference for developers and sysadmins.

SL
Seven Labs · 6 January 2026
2,825 words

The Ultimate Security Headers Checklist: Securing Your Server in 2026

When we discuss web application security, defending against the OWASP Top 10, and hardening server infrastructure, there is one mechanism that consistently offers the highest return on investment: HTTP Security Headers. Implementing the right HTTP security headers is a straightforward, low-cost intervention that instantly protects your web applications from entire classes of vulnerabilities, including Cross-Site Scripting (XSS), clickjacking, MIME-type sniffing, and protocol downgrade attacks.

In this comprehensive, deeply technical guide from SecHead, we provide the ultimate security headers checklist. Whether you are a web developer, a security engineer, or a system administrator, this authoritative resource covers every header you need, why it matters, the exact configuration values to use, and how to deploy them across Nginx, Apache, and Node.js.


Quick Answer: What is the Security Headers Checklist?

To immediately secure your web application and achieve a hardened baseline, you must implement these six essential HTTP security headers in your server's responses:

  1. Content-Security-Policy (CSP): Restricts resource loading (scripts, styles, images) to trusted origins, mitigating XSS.
  2. Strict-Transport-Security (HSTS): Forces encrypted (HTTPS) connections, preventing SSL stripping and protocol downgrades.
  3. X-Frame-Options (XFO): Prevents clickjacking by disallowing your site from being embedded in an iframe.
  4. X-Content-Type-Options: Stops browsers from MIME-sniffing responses, preventing malicious file execution.
  5. Referrer-Policy: Controls how much referrer information (URL data) is passed to other sites, preventing data leaks.
  6. Permissions-Policy: Restricts access to sensitive browser features like the camera, microphone, and geolocation.

People Also Ask

What are HTTP security headers? HTTP security headers are key-value pairs returned by a web server in an HTTP response. They provide instructions to the user's web browser on how to behave securely, such as enforcing HTTPS, restricting script execution, or blocking iframe embedding.

Is X-XSS-Protection still necessary? No. Modern browsers have removed the built-in XSS Auditor due to bypasses and the fact that it occasionally introduced new vulnerabilities. The X-XSS-Protection header is deprecated, and you should rely entirely on a robust Content-Security-Policy instead.

How do I test if my security headers are configured correctly? You can test your security headers manually using command-line tools like curl, inspecting the Network tab in your browser's Developer Tools, or using automated security scanning platforms like the SecHead scanner to receive a comprehensive grade and remediation steps.


The OWASP Top 10 Connection

The Open Worldwide Application Security Project (OWASP) Top 10 lists the most critical security risks to web applications. HTTP security headers directly address several of these categories:

  • A03:2021 - Injection: Specifically Cross-Site Scripting (XSS). CSP is the most effective defense-in-depth measure against XSS.
  • A05:2021 - Security Misconfiguration: Failing to implement secure HTTP headers is explicitly categorized under security misconfiguration.
  • A02:2021 - Cryptographic Failures: Lack of HSTS leaves users vulnerable to Man-in-the-Middle (MitM) attacks and SSL stripping.

By applying this security headers checklist, you instantly close the gap on several OWASP critical risks.


The Essential Six: The Ultimate Security Headers Checklist

These are the headers every production site must have. There are no exceptions for modern web applications.

1. Content-Security-Policy (CSP)

What it does: CSP tells the browser which origins are approved sources for executing scripts, loading stylesheets, rendering images, and fetching data. Anything not explicitly whitelisted by the policy is blocked by the browser.

Why it matters: CSP is your primary line of defense against Cross-Site Scripting (XSS) attacks. Without it, if an attacker successfully injects a malicious script into your HTML, the browser will execute it, allowing the attacker to exfiltrate session cookies, hijack user accounts, or redirect the user to a phishing site.

Minimum Viable Value:

Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; object-src 'none'; frame-ancestors 'none';

Critical Gotchas:

  • 'unsafe-inline' in script-src entirely defeats CSP's XSS protection. If you allow inline scripts, an attacker can inject <script>malicious code</script> directly. You must remove 'unsafe-inline' and use cryptographic nonces or SHA hashes for inline scripts.
  • 'unsafe-eval' permits the use of eval() and new Function(), which are highly dangerous. Avoid it unless absolutely required by a legacy framework.
  • If you omit frame-ancestors 'none', you must rely on X-Frame-Options for clickjacking protection.
🚨 CRITICAL SECURITY ALERT: CSP Violation Detected
The browser blocked the execution of an inline script because it violates the Content Security Policy directive: "script-src 'self'".
Action: Refactor inline scripts into external files or apply cryptographic nonces.

2. Strict-Transport-Security (HSTS)

What it does: HSTS tells browsers to strictly connect to your website over HTTPS, caching this rule for a specified duration. Even if a user manually types http://yourdomain.com or clicks an HTTP link, the browser internally upgrades the request to HTTPS before sending it over the network.

Why it matters: Without HSTS, the initial redirect from HTTP to HTTPS happens over plaintext. An attacker on a shared network (like public Wi-Fi) can intercept this initial HTTP request and perform SSL stripping, keeping the user on an unencrypted connection to steal their credentials.

Recommended Value:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
  • max-age=31536000: Instructs the browser to remember this rule for 1 year (in seconds).
  • includeSubDomains: Applies the HSTS policy to all subdomains (e.g., api.domain.com, blog.domain.com).
  • preload: Indicates consent to be included in the browser's hardcoded HSTS preload list, ensuring users connect via HTTPS even on their very first visit.
https://sechead.com
🔒 Connection is secure
---
HSTS Preload Active: Your browser has hardcoded instructions to never communicate with this domain over an unencrypted connection.

3. X-Frame-Options (XFO)

What it does: Prevents your webpage from being rendered inside a <frame>, <iframe>, <embed>, or <object> on another website.

Why it matters: This header is the primary defense against Clickjacking (UI Redressing). In a clickjacking attack, an adversary embeds your site in a transparent iframe overlaying a malicious page. The user believes they are clicking a harmless button (like "Play Game"), but they are actually clicking an invisible button on your site (like "Transfer Funds" or "Delete Account").

Recommended Values (Pick One):

X-Frame-Options: DENY

(Prevents framing entirely, even by your own site).

X-Frame-Options: SAMEORIGIN

(Allows framing only if the embedding site shares the exact same origin).

Note: Modern browsers support the frame-ancestors directive in CSP, which supersedes X-Frame-Options. However, including XFO provides critical backward compatibility for legacy browsers.

4. X-Content-Type-Options

What it does: Forces the browser to honor the Content-Type header provided by the server, actively stopping the browser from attempting to guess (or "sniff") the MIME type of a file.

Why it matters: Historically, browsers tried to be helpful by inspecting the contents of a file to determine its type, regardless of what the server claimed. If you allowed users to upload a .jpg image, but the file contained malicious JavaScript, the browser might sniff the content, realize it's code, and execute it. This is a severe XSS vector. Setting this header explicitly disables MIME-sniffing.

The Only Correct Value:

X-Content-Type-Options: nosniff

5. Referrer-Policy

What it does: Dictates exactly how much URL information (the referrer) the browser includes when a user navigates away from your page or fetches cross-origin resources.

Why it matters: URLs frequently contain sensitive information, such as password reset tokens, session IDs, internal organizational structures, or private search queries. If a user clicks a link to an external site, your full URL is sent to that site in the Referer header, leaking this sensitive data to third-party analytics and server logs.

Recommended Value:

Referrer-Policy: strict-origin-when-cross-origin

This value sends the full URL path for same-origin requests, but truncates the referrer to just the domain (the origin) for cross-origin requests. Crucially, it sends absolutely no referrer data when downgrading from HTTPS to HTTP.

6. Permissions-Policy

What it does: Formerly known as Feature Policy, Permissions-Policy allows developers to selectively enable, disable, and control the behavior of powerful browser APIs and features within their web application and any embedded iframes.

Why it matters: It operates on the principle of least privilege. If your website does not need to access the user's camera, microphone, or geolocation, you should explicitly turn off those APIs. If a vulnerability like XSS occurs, the injected script will be hardware-blocked from spying on the user via the webcam.

Recommended Starting Point:

Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=(), usb=(), autoplay=()

The () syntax indicates that the feature is disabled entirely for all origins.


Advanced & Upcoming Security Headers (COOP, COEP, CORP)

As the web platform evolves, browsers are implementing advanced headers designed to isolate origins and prevent sophisticated CPU side-channel attacks, such as Spectre and Meltdown. While not universally penalized if missing, adopting these now future-proofs your server security.

Cross-Origin-Opener-Policy (COOP)

Cross-Origin-Opener-Policy: same-origin

COOP explicitly isolates your browsing context from other documents. If another site opens your application in a popup window using window.open(), COOP breaks the DOM linkage, ensuring the malicious site cannot manipulate your window object.

Cross-Origin-Embedder-Policy (COEP)

Cross-Origin-Embedder-Policy: require-corp

COEP prevents a document from loading any cross-origin resources that don't explicitly grant permission via CORS (Cross-Origin Resource Sharing) or CORP.

Cross-Origin-Resource-Policy (CORP)

Cross-Origin-Resource-Policy: same-origin

CORP prevents other websites from embedding your resources (like images or scripts), defending against cross-site leaks and side-channel data exfiltration.


Server Configuration Snippets

Adding security headers to your infrastructure depends on your web server or application framework. Below are robust, production-ready configuration snippets for the most common environments.

1. Nginx Configuration

To apply these headers in Nginx, add the add_header directives to your server block or location block.

server {
    listen 443 ssl http2;
    server_name www.sechead.com;

    # Security Headers
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
    add_header X-Frame-Options "DENY" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always;
    add_header Content-Security-Policy "default-src 'self'; script-src 'self'; object-src 'none';" always;

    # The 'always' flag ensures headers are appended even for error responses (404, 500)
    
    location / {
        try_files $uri $uri/ =404;
    }
}

2. Apache Configuration

For Apache, you utilize the mod_headers module. Ensure it is enabled (a2enmod headers), then add the following to your .htaccess file or <VirtualHost> configuration.

<IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
    Header always set X-Frame-Options "DENY"
    Header always set X-Content-Type-Options "nosniff"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
    Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
    Header always set Content-Security-Policy "default-src 'self'; script-src 'self'; object-src 'none';"
</IfModule>

3. Node.js (Express with Helmet)

In Node.js web applications, the most efficient way to manage security headers is by using the helmet middleware package. It comes with secure defaults and is highly configurable.

const express = require('express');
const helmet = require('helmet');

const app = express();

// Use Helmet to set secure HTTP headers
app.use(helmet());

// Customizing Helmet for strict CSP and custom headers
app.use(
  helmet({
    contentSecurityPolicy: {
      directives: {
        defaultSrc: ["'self'"],
        scriptSrc: ["'self'", "'nonce-randomlyGeneratedNonce'"],
        objectSrc: ["'none'"],
        upgradeInsecureRequests: [],
      },
    },
    referrerPolicy: {
      policy: "strict-origin-when-cross-origin",
    },
    hsts: {
      maxAge: 31536000,
      includeSubDomains: true,
      preload: true,
    },
  })
);

app.get('/', (req, res) => {
  res.send('Node.js API secured with Helmet!');
});

app.listen(3000);

Testing & Troubleshooting Security Headers

Once you've implemented your headers, verification is mandatory. You cannot assume configuration directives successfully propagated without testing.

Using cURL for Raw Inspection

System administrators frequently use curl to view raw HTTP response headers directly from the terminal.

$ curl -I https://sechead.com
HTTP/2 200 OK
date: Mon, 22 Jun 2026 08:21:58 GMT
content-type: text/html; charset=utf-8
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-frame-options: DENY
x-content-type-options: nosniff
referrer-policy: strict-origin-when-cross-origin
content-security-policy: default-src 'self'; script-src 'self'; object-src 'none';
permissions-policy: camera=(), microphone=()
server: nginx

If you see your headers listed with the correct values, your web server is properly configured.

Using Browser Developer Tools

  1. Open Chrome or Firefox.
  2. Press F12 to open Developer Tools.
  3. Navigate to the Network tab.
  4. Refresh the page and click on the primary document request (usually the first item).
  5. Inspect the Response Headers section to verify the presence of CSP, HSTS, XFO, etc.

Frequently Asked Questions (FAQ)

1. What happens if I make a mistake in my Content-Security-Policy? If your CSP is too strict, legitimate resources (like scripts, styles, or images) will be blocked, breaking your website's functionality. It is highly recommended to use the Content-Security-Policy-Report-Only header first, which logs violations without actually blocking anything, allowing you to debug safely.

2. Can I use multiple X-Frame-Options headers? No. Browsers expect a single X-Frame-Options header. If multiple are sent, parsing behavior becomes unpredictable, and the browser may simply ignore them, leaving you vulnerable to clickjacking.

3. Does HSTS affect my local development environment? It can. If you test HSTS on localhost with a high max-age and includeSubDomains, your browser will force HTTPS for all future local development, causing connection errors if you don't run a local SSL server. Clear your browser's HSTS cache to fix this.

4. Why is X-XSS-Protection missing from this checklist? The X-XSS-Protection header relied on browser-based heuristic filtering to detect reflected XSS. It was notoriously buggy, frequently bypassed, and could even be weaponized to disable legitimate scripts. All modern browsers (Chrome, Firefox, Edge, Safari) have retired the feature.

5. How do I implement nonces in CSP? A nonce is a cryptographically secure random string generated on the server for each unique page load. You include it in your CSP header: script-src 'nonce-rAnd0m123'; and attach it to your inline scripts: <script nonce="rAnd0m123">.

6. Do these headers impact SEO? Indirectly, yes. Google factors security into its ranking algorithms (specifically HTTPS). Furthermore, a compromised site due to missing headers (e.g., infected with malware via XSS) will be blacklisted by Google Safe Browsing, destroying your SEO rankings entirely.

7. Should APIs return security headers? Yes. While APIs aren't typically rendered in a browser, returning headers like X-Content-Type-Options: nosniff and a restrictive Content-Security-Policy prevents API responses from being maliciously interpreted if directly navigated to by a browser.

8. Is X-Frame-Options: SAMEORIGIN completely safe? It is safe against cross-site clickjacking, but it does not protect against clickjacking attacks originating from a compromised page on the same domain. For maximum security, use DENY unless framing is absolutely strictly required.

9. What is the difference between HSTS and a simple 301 redirect to HTTPS? A 301 redirect is easily intercepted on the initial HTTP request by an attacker performing SSL stripping. HSTS forces the browser to permanently remember the HTTPS requirement, preemptively upgrading the request internally before any network traffic is sent.

10. How do I get my domain on the HSTS preload list? You must serve a valid HSTS header with max-age of at least one year, includeSubDomains, and the preload directive. Once configured, you submit your domain to hstspreload.org.

11. Can Referrer-Policy break third-party analytics? If configured too strictly (e.g., no-referrer), third-party analytics tools like Google Analytics will lose data regarding where your traffic is coming from. strict-origin-when-cross-origin is the sweet spot that protects user privacy while retaining high-level domain attribution.

12. What are the performance impacts of HTTP security headers? The performance impact is virtually zero. Security headers are lightweight text strings (typically less than a kilobyte) added to the HTTP response payload. They introduce no server-side processing overhead.

13. Do security headers replace a Web Application Firewall (WAF)? No. Security headers are a client-side (browser) defense mechanism. A WAF operates on the server-side, analyzing incoming network traffic to block malicious payloads before they hit your application logic. Both are required for defense-in-depth.

14. What is the Server header and should I remove it? The Server header discloses the software and version running on your infrastructure (e.g., Server: Apache/2.4.41). It is considered an information leak that aids attackers in finding version-specific exploits. You should obscure or remove it completely.

15. How often should I review my security headers? Security standards evolve rapidly. You should review your headers at least bi-annually, whenever you migrate infrastructure, or when rolling out major architectural changes to your front-end stack.


Conclusion

Securing your web application doesn't always require expensive enterprise software or complex architectural redesigns. By diligently applying this ultimate security headers checklist, you establish an incredibly resilient baseline against XSS, clickjacking, protocol downgrades, and data exfiltration.

At SecHead, our mission is to make robust cybersecurity accessible to every developer and system administrator. Implement the essential six headers today, validate your configuration using our tools, and take pride in running a hardened, professional-grade infrastructure.


SEO_METADATA:
  Meta_Title: "The Ultimate Security Headers Checklist (2026 Guide)"
  Meta_Description: "Master HTTP security headers to protect your web servers from OWASP Top 10 vulnerabilities. Includes configs for Nginx, Apache, and Node.js."
  URL_Slug: "ultimate-security-headers-checklist"
  Primary_Keyword: "Security Headers Checklist"
  Secondary_Keywords: ["HTTP Security Headers", "OWASP Top 10", "Server Security", "Content-Security-Policy", "HSTS"]

Continue your journey into web security with these related, deep-dive articles from the SecHead team:

Free tool

Check your own security headers

Instant grade, plain-language explanations, and a full remediation plan - no signup needed.

Scan your site now →