Use the SecurityHeaders.com extension or similar tools to inspect HTTP security headers directly in Chrome without custom scripts. Security headers protect applications from XSS, clickjacking, and data injection attacks, but many developers struggle to test and verify these headers during development. Browser extensions solve this by letting you inspect response headers and identify missing configurations without leaving Chrome. This guide covers the best Chrome extensions for testing security headers, common mistakes, and which headers should be your priority.
Why Security Headers Matter
When a browser requests a webpage, the server responds with HTTP headers that tell the browser how to handle the content. Security-related headers instruct the browser to enable protections such as:
- Content-Security-Policy (CSP): Prevents XSS by controlling which resources can load
- Strict-Transport-Security (HSTS): Forces HTTPS connections
- X-Content-Type-Options: Stops browsers from MIME-sniffing responses
- X-Frame-Options: Protects against clickjacking
- Referrer-Policy: Controls information sent in the Referer header
Without these headers, your application relies entirely on client-side code for protection—a risky assumption. Implementing proper headers adds a server-side defense layer that works before any malicious script executes.
Essential Chrome Extensions for Security Headers
1. HTTP Headers
The HTTP Headers extension (available in the Chrome Web Store) displays all HTTP response headers for each request. It shows headers in a pop-up when you click the extension icon, making it easy to verify server configuration without opening DevTools.
Extension: HTTP Headers
Features:
- Displays all response headers
- Shows request and response timing
- Copy headers to clipboard
- Filter by header name
This extension works well for quick checks. Open any page, click the icon, and you’ll see every header the server sends. Look for security headers in the list—they’ll typically appear near the bottom.
2. ModHeader
ModHeader lets you add, modify, or remove HTTP request and response headers. This is particularly useful for testing how your application behaves with specific security headers or for simulating attacks to verify your protections work.
Extension: ModHeader
Useful for:
- Adding custom headers for testing
- Removing headers to test fallback behavior
- Simulating missing security headers
- Testing CSP violations
To test CSP, add a response header in ModHeader:
Header name: Content-Security-Policy
Header value: default-src 'self'
Then visit your site and try loading a resource from an external domain. The browser blocks the request, and you can verify your CSP is working.
3. Security Headers (by SpiderLabs)
The Security Headers extension specifically analyzes security headers and provides a grade (A-F) based on industry best practices. It checks for the presence and configuration of key security headers.
Security Headers Checklist:
✓ Strict-Transport-Security
✓ Content-Security-Policy
✓ X-Content-Type-Options
✓ X-Frame-Options
✓ Referrer-Policy
✓ Permissions-Policy
✓ X-XSS-Protection (legacy)
The extension displays results directly in the browser toolbar, showing which headers are present and which are missing. This gives you an immediate security posture overview for any site.
Practical Examples
Checking Your Own Site
- Install the HTTP Headers extension
- Navigate to your development or staging site
- Click the extension icon
- Scroll through the headers list
- Verify these security headers are present:
Strict-Transport-Security: max-age=31536000; includeSubDomains X-Content-Type-Options: nosniff X-Frame-Options: DENY Content-Security-Policy: default-src 'self'
Testing CSP Without Deploying
Use ModHeader to test CSP rules before modifying your server configuration:
// In ModHeader, add response header:
// Content-Security-Policy: script-src 'self' https://trusted-cdn.com
// Then test:
// 1. Load your site - scripts from self should work
// 2. Try inline scripts - they should be blocked
// 3. Try scripts from untrusted domains - blocked
This approach lets you validate your CSP policy without deploying to production.
Analyzing Third-Party Sites
Visit any website and use the Security Headers extension to quickly assess its security posture. You might discover that major sites still miss basic protections—an eye-opening reminder to audit your own implementations.
Headers You Should Implement
Focus on these headers in order of priority:
-
Strict-Transport-Security: Forces HTTPS. Start with
max-age=31536000; includeSubDomains -
X-Content-Type-Options: Set to
nosniffto prevent MIME-type sniffing -
X-Frame-Options: Use
DENYorSAMEORIGINto prevent clickjacking -
Content-Security-Policy: Start simple with
default-src 'self', then refine -
Referrer-Policy: Use
strict-origin-when-cross-originfor privacy -
Permissions-Policy: Control browser features like camera, microphone, and geolocation
Common Pitfalls
When implementing security headers, watch for these issues:
- CSP too restrictive: Start with report-only mode using
Content-Security-Policy-Report-Onlyto identify issues before enforcing - HSTS without testing: A bad HSTS configuration can break your site for months due to the long max-age. Test on a subdomain first
- Overly permissive CSP: Avoid
'unsafe-inline'and'unsafe-eval'unless absolutely necessary - Missing headers on error pages: Ensure your error pages also return security headers
Building a Custom Security Header Audit Script
For developers managing multiple applications, automate security header audits:
// audit-security-headers.js - Run this in browser console or as Node script
const criticalHeaders = [
'Strict-Transport-Security',
'X-Content-Type-Options',
'X-Frame-Options',
'Content-Security-Policy'
];
async function auditHeaders(url) {
try {
const response = await fetch(url, { method: 'HEAD' });
const headers = {};
response.headers.forEach((value, key) => {
headers[key.toLowerCase()] = value;
});
const audit = {
url: url,
timestamp: new Date().toISOString(),
results: {
passed: [],
missing: [],
warnings: []
}
};
criticalHeaders.forEach(header => {
const headerLower = header.toLowerCase();
if (headers[headerLower]) {
audit.results.passed.push({
header: header,
value: headers[headerLower]
});
} else {
audit.results.missing.push(header);
}
});
// Additional checks
if (headers['x-xss-protection'] === '0') {
audit.results.warnings.push('X-XSS-Protection is disabled (intentional?)');
}
return audit;
} catch (error) {
console.error(`Audit failed for ${url}:`, error);
}
}
// Usage: Run audit on multiple endpoints
const endpoints = [
'https://api.example.com',
'https://example.com',
'https://dashboard.example.com'
];
Promise.all(endpoints.map(auditHeaders)).then(results => {
console.table(results);
// Export to JSON for tracking over time
console.log(JSON.stringify(results, null, 2));
});
Run this script monthly and track changes. When you add a new header, verify it propagated to all endpoints.
Real-World Security Header Implementations
Here’s what production implementations actually look like:
Tight Security (B2B SaaS with sensitive data):
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-abc123'; style-src 'self' fonts.googleapis.com
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: geolocation=(), microphone=(), camera=()
Balanced Security (SaaS with external integrations):
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: default-src 'self'; script-src 'self' cdn.example.com; img-src 'self' data: https:
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=()
Permissive Security (Public marketing site with many third-party tools):
Strict-Transport-Security: max-age=31536000
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: default-src 'self' https:; script-src 'self' 'unsafe-inline' https:
Referrer-Policy: no-referrer-when-downgrade
The trade-off: tighter CSP prevents more attacks but breaks more integrations. Start tight and relax only when necessary.
Content-Security-Policy: The Deep Dive
CSP is the most complex header and worth understanding thoroughly:
# CSP Anatomy
default-src 'self' # Default policy for all content types
├─ Applies unless overridden by specific directive
└─ 'self' = same origin, nothing else
script-src 'self' 'nonce-XYZ' # Where scripts can load from
├─ 'self': scripts from your domain
├─ 'nonce-XYZ': inline scripts with matching nonce attribute
└─ Blocks all other inline scripts and external sources
style-src 'self' data: # Where stylesheets can come from
├─ 'self': stylesheets from your domain
├─ data: embedded data URIs
└─ Blocks external CDN stylesheets unless explicitly allowed
img-src * # Images can load from anywhere
font-src 'self' fonts.gstatic.com # Fonts from self or Google
connect-src 'self' https://api.example.com # XHR/fetch/WebSocket destinations
Common CSP mistakes:
- Using
'unsafe-inline'for styles/scripts — defeats the purpose of CSP - Using
*for script-src — allows any attacker-controlled script - Forgetting to update CSP when adding third-party tools — tools break mysteriously
- Not using nonce/hash for inline scripts — undermines security
Testing CSP without breaking production:
Content-Security-Policy-Report-Only: ...
Use -Report-Only first. This logs violations without blocking anything. Monitor for 1-2 weeks, fix issues, then switch to enforcing mode.
Practical Incident Response Using Headers
When you discover a security issue, security headers help contain damage:
# Incident: Third-party library has XSS vulnerability
Response using CSP:
1. Review CSP: does script-src allow this library?
2. If yes: remove from CSP immediately
3. Notify users that content from library domain is blocked
4. Library users experience some feature breakage but are protected from XSS
5. Update to patched version
6. Re-add to CSP after verification
Without CSP:
1. Users are vulnerable until they update browsers
2. Library XSS attack steals session tokens
3. Incident response is reactive, not preventive
Good headers let you act defensively immediately, even before patches exist.
Monitoring Header Compliance Over Time
Track compliance across your infrastructure:
# Security header monitoring dashboard
import requests
from datetime import datetime
from collections import defaultdict
class SecurityHeaderMonitor:
def __init__(self):
self.endpoints = [
'https://api.example.com',
'https://example.com',
'https://admin.example.com'
]
self.required_headers = [
'Strict-Transport-Security',
'X-Content-Type-Options',
'X-Frame-Options'
]
def check_endpoint(self, url):
try:
resp = requests.head(url, timeout=5)
headers = {k.lower(): v for k, v in resp.headers.items()}
status = {
'url': url,
'timestamp': datetime.now().isoformat(),
'compliant': True,
'missing_headers': []
}
for header in self.required_headers:
if header.lower() not in headers:
status['missing_headers'].append(header)
status['compliant'] = False
return status
except Exception as e:
return {
'url': url,
'error': str(e),
'compliant': False
}
def audit_all(self):
results = []
for endpoint in self.endpoints:
results.append(self.check_endpoint(endpoint))
return results
# Run daily via CI/CD
monitor = SecurityHeaderMonitor()
audit_results = monitor.audit_all()
# Alert if any endpoint is non-compliant
non_compliant = [r for r in audit_results if not r.get('compliant')]
if non_compliant:
send_slack_alert(f"Security header audit failed: {non_compliant}")
This catches configuration drift (headers accidentally removed during deployments).
Browser DevTools Alternative: Network Tab Inspection
If you prefer not to use extensions, inspect headers directly:
- Open Chrome DevTools (F12)
- Go to Network tab
- Reload the page
- Click the main document request (usually first in list)
- Check Headers section: scroll to “Response Headers”
- Look for security-related headers (Strict-Transport-Security, CSP, etc.)
This is slower than extensions but requires no installation and provides detailed header inspection.
Common Questions About Security Headers
Q: Will security headers break my site?
A: Start with Content-Security-Policy-Report-Only first. Only enforce after verifying nothing breaks. Other headers rarely cause issues.
Q: Do security headers replace HTTPS? A: No, they complement HTTPS. Strict-Transport-Security forces HTTPS, but other headers (CSP, X-Frame-Options) add application-level protections.
Q: How often should I audit headers? A: After every deployment. Monthly automated audits catch drift. Whenever adding third-party integrations, verify CSP still allows them.
Q: What’s the difference between X-XSS-Protection and CSP? A: X-XSS-Protection is legacy (for old browsers). CSP is modern. Use CSP for new applications.
Related Articles
- Chrome Extension Linear Issue Tracker: Practical Guide
- Chrome Extension Compress Images Before Upload: A
- Chrome Extension Currency Converter for Shopping: A
- Chrome Extension MLA Citation Generator: A Developer Guide
- Chrome Extension Newsletter Design Tool: A Developer’s Guide
Built by theluckystrike — More at zovo.one