ES
navigate Enter open Esc close
Security & HTTP Headers

HTTP Security Headers Auditor

Audit HTTP security headers on any URL for free (CSP, HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy) and generate fix patches for Apache .htaccess and Nginx.

Complete Technical Guide to HTTP Security Headers, OWASP Hardening & Server Configuration

HTTP security headers are specialized response directives transmitted by web servers (such as Nginx, Apache, Caddy, Cloudflare, and LiteSpeed) to client web browsers. These headers dictate fundamental security constraints, sandboxing execution environments, enforcing cryptographic protocols, and severely restricting how external scripts, media, and nested frames interact with your web application.

Implementing a robust security header policy represents a critical layer of defense-in-depth recommended by OWASP (Open Web Application Security Project). Correctly configured headers neutralize major vulnerability classes including Cross-Site Scripting (XSS), Clickjacking, MIME sniffing, data exfiltration, and SSL-stripping Man-in-the-Middle (MitM) attacks with zero impact on server latency.

The 6 Essential Security Headers Analyzed in the Audit

Our auditor performs real-time inspection of the following critical response directives:

  • Strict-Transport-Security (HSTS): Forces browsers to connect exclusively over HTTPS, mitigating SSL-stripping and cookie hijacking. Optimal directive: max-age=31536000; includeSubDomains; preload.
  • Content-Security-Policy (CSP): Restricts authorized script sources, connect-src endpoints, and inline script execution, effectively disabling Cross-Site Scripting (XSS) payload delivery.
  • X-Frame-Options: Prevents malicious third-party websites from framing your pages inside hidden <iframe> tags, eliminating UI redressing and Clickjacking attacks. Optimal values: DENY or SAMEORIGIN.
  • X-Content-Type-Options: Enforces strict MIME typing (nosniff), preventing browsers from executing user-uploaded images or text files as executable JavaScript.
  • Referrer-Policy: Controls how much URL referrer metadata is passed to external domains. Optimal directive: strict-origin-when-cross-origin.
  • Permissions-Policy: Restricts browser hardware APIs (geolocation, camera, microphone, accelerometer) within your domain.

Scoring Algorithm and Letter Grades (A+ to F)

The audit engine evaluates your server responses against modern cybersecurity benchmarks. A score of 100/100 and an A+ Grade requires valid, fully-scoped directives for all 6 headers, including active HSTS preloading eligibility and a strictly partitioned CSP. Points are deducted proportionately for missing headers, permissive wildcards (e.g. unsafe-inline without nonces), or insecure fallback modes.

Remediation Workflow for Nginx and Apache Web Servers

Securing your web server requires appending response headers to your virtual host configuration:

  • Nginx (nginx.conf / site block): Use the add_header directive inside your server {} or location {} block with the always parameter (e.g., add_header X-Frame-Options "SAMEORIGIN" always;).
  • Apache (.htaccess / httpd.conf): Enable mod_headers and utilize the Header always set directive (e.g., Header always set X-Content-Type-Options "nosniff").
  • Cloudflare Workers / Transform Rules: You can dynamically append response headers at the edge network without touching origin code.

CSP Deployment Strategy: Report-Only vs. Enforced Blocking

Deploying an overly strict Content-Security-Policy on an existing website can inadvertently block legitimate analytics tags, video players, or font CDNs. Best practice dictates launching CSP in monitoring mode using Content-Security-Policy-Report-Only with a report-uri endpoint. Review console violation reports for 1-2 weeks, whitelist legitimate assets, and then transition to active enforcement.

SEO and Compliance Benefits of Security Header Hardening

In addition to thwarting cyberattacks, strong security postures protect brand reputation. Google Chrome actively displays warning badges on websites failing basic security compliance. High security grades prevent malware injection that triggers blacklisting in Google Safe Browsing, ensuring continuous organic visibility and user trust.

Practical Example

Example 1: Hardened Nginx Production Server Security Configuration
Input: Target: Production Nginx Reverse Proxy | Domain: https://example.com
Output / Result: server {\n add_header X-Frame-Options "SAMEORIGIN" always;\n add_header X-Content-Type-Options "nosniff" always;\n add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;\n add_header Referrer-Policy "strict-origin-when-cross-origin" always;\n}

Secures the web server against clickjacking, MIME sniffing, and SSL downgrade attacks with grade A+ compliance.

Example 2: Apache .htaccess Security Directives for E-Commerce
Input: Target: Apache 2.4 Server with mod_headers enabled
Output / Result: <IfModule mod_headers.c>\n Header always set X-Frame-Options "DENY"\n Header always set X-Content-Type-Options "nosniff"\n Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"\n</IfModule>

Prevents iframe clickjacking and blocks unauthorized camera/microphone access in user browsers.

How to Audit & Fix HTTP Security Headers in 4 Steps

1

Enter Target URL

Type your full website URL (e.g. `https://yourdomain.com`) into the input box above.

2

Run Security Scan

Click "Audit Security Headers" to send an encrypted server-side probe inspecting HTTP response headers.

3

Review Score & Missing Directives

Examine your letter grade (A+ to F) and check which critical headers (CSP, HSTS, X-Frame) are missing.

4

Copy & Apply Server Fixes

Copy the pre-configured Apache (`.htaccess`) or Nginx code snippets and deploy to your server.

Frequently Asked Questions about HTTP Security Headers

What are HTTP security headers and why are they critical for website defense?

HTTP security headers are response directives sent by your web server to the client browser instructing it on how to handle content, enforce encrypted connections, and restrict execution contexts. They provide essential defense-in-depth against Cross-Site Scripting (XSS), Clickjacking, code injection, and data eavesdropping.

How does Content-Security-Policy (CSP) protect against XSS attacks?

Content-Security-Policy (CSP) restricts the domains from which scripts, stylesheets, fonts, and media can be loaded, and disallows unauthorized inline JavaScript execution (eval, inline script tags). This stops attackers from injecting and executing malicious third-party scripts even if a form or parameter contains an XSS vulnerability.

What is HTTP Strict Transport Security (HSTS) and HSTS Preloading?

Strict-Transport-Security (HSTS) forces web browsers to communicate exclusively over encrypted HTTPS connections, preventing SSL-stripping and man-in-the-middle attacks. HSTS Preloading registers your domain directly into browser vendor hardcoded lists (Chrome, Firefox, Safari), ensuring even the very first connection is HTTPS.

Why are X-Frame-Options and X-Content-Type-Options mandatory?

`X-Frame-Options: DENY` (or `SAMEORIGIN`) prevents your web pages from being embedded inside invisible `` on malicious websites, eliminating Clickjacking attacks. `X-Content-Type-Options: nosniff` forces browsers to adhere strictly to declared MIME types, stopping MIME-confusion and script execution disguised as images.

How can I deploy security headers on Apache or Nginx servers without breaking my website?

Use our tool to audit your domain, review missing headers, and copy the tailored configuration directives for Apache (`.htaccess` via `Header always set`) or Nginx (`nginx.conf` via `add_header`). Test CSP rules in `Content-Security-Policy-Report-Only` mode initially to detect blocked legitimate resources before enforcing.

Share this tool

Help others by sharing this free tool.