HTTP Security Headers Evaluator
Audit HTTP response headers against OWASP security standards for HSTS, CSP, X-Frame-Options, and Referrer-Policy.
Unlike conventional calculator sites that send your financial numbers, payload data, or code snippets across remote web servers, Affi-Chain processes all mathematical derivations, algorithms, and data parsing 100% locally within your browser sandbox. No tracking cookies, no server-side retention, and zero transmission lag.
What are HTTP Security Headers?
HTTP Security Headers are specialized response headers that a web server transmits to a client’s browser to instruct the browser’s security engine on how to handle website content, restrict cross-origin interactions, enforce transport encryption, and isolate execution contexts.
In modern cybersecurity architectures governed by the OWASP Top 10 and NIST frameworks, software vulnerabilities (such as Cross-Site Scripting / XSS, Clickjacking, MIME-confusion attacks, and Man-in-the-Middle / MitM interception) cannot be mitigated solely through application-level code. Even a perfectly sanitized React or Next.js application remains vulnerable if the web server fails to instruct the browser to enforce secure transport and content boundaries.
The Affi-Chain Security Headers Checker inspects remote web endpoints, evaluates their cryptographic and architectural headers against industry standards (OWASP, NIST, and Mozilla Observatory guidelines), and provides actionable, copy-paste configuration snippets to achieve an A+ Security Grade.
The 7 Essential HTTP Security Headers Matrix
Modern web infrastructure requires seven core headers to protect user privacy and system integrity:
| Header | Standard Specification | Recommended Production Value | Attack Vector Mitigated |
|---|---|---|---|
Strict-Transport-Security (HSTS) | RFC 6797 | max-age=63072000; includeSubDomains; preload | SSL Stripping, Man-in-the-Middle (MitM) wiretapping, packet sniffing. |
Content-Security-Policy (CSP) | W3C CSP Level 3 | default-src 'self'; script-src 'self'; object-src 'none'; | Cross-Site Scripting (XSS), malicious script injections, data exfiltration. |
X-Frame-Options | RFC 7034 | DENY or SAMEORIGIN | Clickjacking attacks via hidden transparent iframes. |
X-Content-Type-Options | Fetch Standard | nosniff | MIME-type confusion attacks and executable script disguised as images. |
Referrer-Policy | W3C Referrer Policy | strict-origin-when-cross-origin | Sensitive URL token leaks across third-party analytics and ad trackers. |
Permissions-Policy | W3C Permissions Policy | camera=(), microphone=(), geolocation=(), browsing-topics=() | Unauthorized access to user hardware peripherals and sensor telemetry. |
Cross-Origin-Opener-Policy (COOP) | HTML Living Standard | same-origin | Cross-origin information leaks and Spectre side-channel memory attacks. |
Detailed Breakdown of Critical Directives
1. HTTP Strict Transport Security (HSTS)
HSTS forces the browser to communicate exclusively over encrypted HTTPS connections, even if a user manually types http:// into the address bar or clicks an insecure link.
max-age=63072000: Tells the browser to remember this HTTPS enforcement rule for two full years (63,072,000 seconds).includeSubDomains: Automatically protects all subdomains (api.affichain.com,admin.affichain.com).preload: Submits your domain to Google Chrome's hardcoded global preload list, ensuring even the very first connection is encrypted before DNS resolution occurs.
2. Content Security Policy (CSP)
CSP is the single most powerful defense against Cross-Site Scripting (XSS). It acts as a strict whitelist defining precisely which domains are authorized to load JavaScript, stylesheets, images, and fonts:
default-src 'self': Restricts all resources to your own domain by default.script-src 'self': Completely blocks inline<script>tags and untrusted external CDNs unless explicitly permitted.object-src 'none': Disables legacy plugins like Flash, Java applets, and Silverlight.base-uri 'self': Prevents<base>tag injection attacks that redirect relative URLs to an attacker's server.
3. X-Frame-Options (Clickjacking Defense)
Clickjacking occurs when an attacker renders your login page or payment screen inside an invisible, transparent iframe layered beneath an enticing game or button on their website.
- Setting
X-Frame-Options: DENYinstructs the browser to never allow your site to be framed by any external website.
Production Server Configurations
1. Next.js (next.config.js or next.config.mjs)
const securityHeaders = [
{ key: 'X-DNS-Prefetch-Control', value: 'on' },
{ key: 'Strict-Transport-Security', value: 'max-age=63072000; includeSubDomains; preload' },
{ key: 'X-Frame-Options', value: 'DENY' },
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
{ key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' }
];
module.exports = {
async headers() {
return [
{
source: '/:path*',
headers: securityHeaders,
},
];
},
};
2. Nginx Web Server (nginx.conf)
# Add security headers inside the server block
add_header Strict-Transport-Security "max-age=63072000; 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=()" always;
Critical Deployment Traps & Troubleshooting
1. The HSTS Preload Trap
- Submitting your domain to the HSTS Preload list (
hstspreload.org) is permanent and irrevocable. - The Danger: If you have an internal staging server, legacy subdomain, or local intranet portal (
dev.yourdomain.com) that does not yet possess an active, valid SSL certificate, enforcingincludeSubDomains; preloadwill render that subdomain completely inaccessible worldwide in Chrome, Firefox, and Safari! - Best Practice: Run HSTS with a short duration (
max-age=300) for one week to verify that no internal subdomains break before stepping up to two years.
2. The Broken AdSense & Google Analytics CSP Trap
- If you introduce a rigid
Content-Security-Policy: default-src 'self', you will immediately block Google AdSense, Google Tag Manager, and Vercel Analytics from loading! - When monetizing via advertising, ensure your CSP script whitelist accommodates trusted ad networks:
script-src 'self' 'unsafe-inline' https://www.googletagmanager.com https://pagead2.googlesyndication.com;
3. The Deprecated X-XSS-Protection Header
- Many outdated security tutorials recommend setting
X-XSS-Protection: 1; mode=block. - Security Advisory: Modern security standards explicitly advise removing this header or setting it to
0. Research demonstrated that the legacy XSS auditor built into older Chromium browsers could be weaponized by attackers to create security vulnerabilities (Cross-Site Script Leaks) that did not previously exist. Rely on modern CSP instead.