Analyze HTTP security headers for any website.
HTTP security headers are response headers that instruct browsers how to behave when handling your website's content. Properly configured security headers can protect your users from a wide range of attacks including cross-site scripting (XSS), clickjacking, MIME sniffing attacks, and man-in-the-middle attacks.
Purpose: Forces browsers to only connect via HTTPS, preventing protocol downgrade attacks and cookie hijacking.
Recommended Value:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
max-age: How long (in seconds) to remember this policy (31536000 = 1 year)includeSubDomains: Apply to all subdomainspreload: Allow inclusion in browser HSTS preload listsPurpose: Prevents XSS attacks by specifying which content sources are allowed to load on your page.
Example Value:
Content-Security-Policy: default-src 'self'; script-src 'self' https://trusted.cdn.com; style-src 'self' 'unsafe-inline'
Key Directives:
default-src: Fallback for other directivesscript-src: Controls JavaScript sourcesstyle-src: Controls CSS sourcesimg-src: Controls image sourcesconnect-src: Controls AJAX, WebSocket, etc.frame-ancestors: Controls who can embed your page (replaces X-Frame-Options)Use our CSP Generator to create your policy.
Purpose: Prevents clickjacking attacks by controlling whether your page can be embedded in iframes.
Possible Values:
DENY: Page cannot be displayed in a frameSAMEORIGIN: Page can only be framed by same originALLOW-FROM uri: Page can only be framed by specified origin (deprecated)X-Frame-Options: SAMEORIGIN
Note: CSP's frame-ancestors directive is more flexible and is gradually replacing X-Frame-Options.
Purpose: Prevents MIME type sniffing, where browsers try to guess content types. This can lead to security vulnerabilities when malicious content is interpreted as executable.
Recommended Value:
X-Content-Type-Options: nosniff
This header has only one valid value and should always be set.
Purpose: Enables the browser's built-in XSS filter. However, this header is largely deprecated as modern browsers have removed their XSS auditors.
Recommended Value:
X-XSS-Protection: 0
Modern recommendation: Disable this header and rely on CSP instead. The XSS auditor could itself be exploited in some cases.
Purpose: Controls how much referrer information is sent when navigating from your site. Protects user privacy and prevents leaking sensitive URLs.
Common Values:
no-referrer: Never send referrersame-origin: Only send for same-origin requestsstrict-origin-when-cross-origin: Send full URL for same-origin, only origin for cross-origin HTTPS→HTTPSno-referrer-when-downgrade: Default; send full referrer unless HTTPS→HTTPReferrer-Policy: strict-origin-when-cross-origin
Purpose: Controls which browser features and APIs can be used on your site, including geolocation, camera, microphone, and more.
Example Value:
Permissions-Policy: geolocation=(), camera=(), microphone=()
This example disables geolocation, camera, and microphone access entirely.
Many security standards and regulations require proper security headers:
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
const helmet = require('helmet');
app.use(helmet());