Advanced Security Headers
Configure HSTS, Content Security Policy, and Permissions Policy.
Last updated Feb 3, 2025
ArmorPro includes advanced security headers that provide additional protection but require more careful configuration.
HSTS (Strict-Transport-Security)
HSTS tells browsers to only connect to your site via HTTPS, preventing man-in-the-middle attacks that could downgrade connections to HTTP.
Configuration Options
- max-age: How long (seconds) browsers remember to use HTTPS
- 1 year (31536000) — Recommended for production
- 1 month (2592000) — Good for testing
- includeSubDomains: Apply to all subdomains
- preload: Eligible for browser preload lists
Warning
HSTS is difficult to undo. Once a browser sees an HSTS header with a long max-age, it will refuse HTTP connections even if you remove the header. Only enable when you're committed to HTTPS permanently.
Recommended Setup
- Start with a short max-age (1 day) to test
- Verify your site works properly over HTTPS
- Increase to 1 month, then 1 year
- Only add
includeSubDomainsif all subdomains use HTTPS - Only add
preloadif you want permanent HTTPS enforcement
Content Security Policy (CSP)
CSP is the most powerful security header, controlling which resources can load on your page. It prevents XSS attacks by blocking unauthorized scripts.
CSP Directives
default-src: Fallback for all resource types
'self'— Only your domain'none'— Block everything
script-src: Where JavaScript can load from
'self'— Scripts from your domain'unsafe-inline'— Inline scripts (less secure, but often needed)'unsafe-eval'— eval() and similar (avoid if possible)https://example.com— Specific external domains
style-src: Where CSS can load from
img-src: Where images can load from
font-src: Where fonts can load from
connect-src: Where AJAX/fetch requests can go
frame-src: What can be embedded in iframes
CSP Builder
ArmorPro includes a CSP builder to help create your policy:
- Go to ArmorPro → Headers → CSP
- Use the visual builder to select allowed sources
- Start in Report-Only mode to test without breaking your site
- Review the browser console for violations
- Adjust your policy based on violations
- Switch to Enforce mode when ready
Common CSP Issues
- Google Analytics: Add
https://www.google-analytics.comto script-src and connect-src - Google Fonts: Add
https://fonts.googleapis.comto style-src andhttps://fonts.gstatic.comto font-src - WordPress admin: Consider excluding /wp-admin from CSP or using a relaxed policy there
- Inline scripts: Many WordPress themes/plugins use inline scripts, requiring
'unsafe-inline'
Permissions Policy
Permissions Policy (formerly Feature Policy) controls which browser features your site can use.
Available Features
- camera: Camera access
- microphone: Microphone access
- geolocation: Location access
- payment: Payment Request API
- usb: USB device access
- fullscreen: Fullscreen mode
- autoplay: Media autoplay
Configuration
For each feature, you can set:
- self: Allow only on your domain
- *: Allow everywhere (including iframes)
- none: Disable completely
- specific origins: Allow only on listed domains
Recommended Settings
For most sites, disable features you don't use:
- camera=(), microphone=() — Unless you have video chat
- geolocation=() — Unless you use location features
- payment=() — Unless you use Payment Request API
Testing Your Headers
After configuring advanced headers:
- Visit securityheaders.com
- Check browser console for CSP violations
- Test all site functionality (forms, media, external integrations)
- Test on multiple browsers