🔐 Omega Security Headers Guide

A universal reference for adding modern security headers to any website

Security headers are delivered by the web server, not by WordPress, themes, or plugins. Because every hosting environment is different, no plugin can safely inject these headers automatically.

This guide shows developers how to add industry‑standard security headers on:

Each section includes copy‑paste examples.

🧩 1. What Security Headers Do

Security headers protect your site from:

These headers do not change your site’s content — they instruct the browser how to behave.

🛡️ 2. Recommended Security Headers

HeaderPurpose
Strict-Transport-Security (HSTS)Forces HTTPS and prevents downgrade attacks
X-Frame-OptionsBlocks clickjacking
X-Content-Type-OptionsPrevents MIME sniffing
Referrer-PolicyControls how much referrer info is leaked
Content-Security-Policy (CSP)Blocks XSS, injections, and unauthorized scripts
Permissions-PolicyRestricts browser features (camera, mic, geolocation, etc.)
X-XSS-ProtectionLegacy XSS protection for old browsers
X-Download-OptionsPrevents file download execution in IE
X-Permitted-Cross-Domain-PoliciesControls Flash/Adobe cross-domain access

🏗️ 3. Apache (.htaccess) Example

# Force HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# HSTS (requires HTTPS)
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

# Security Headers
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"
Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
Header always set X-XSS-Protection "1; mode=block"
Header always set X-Download-Options "noopen"
Header always set X-Permitted-Cross-Domain-Policies "none"

🚀 4. Nginx Example

# Force HTTPS
return 301 https://$host$request_uri;

# HSTS
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;

# Security Headers
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;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Download-Options "noopen" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;

⚡ 5. LiteSpeed Example

LiteSpeed supports both Apache and Nginx syntax.

Use .htaccess (recommended):

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"
Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"

Or use the LiteSpeed WebAdmin Console → Headers section.

☁️ 6. Cloudflare Example

Cloudflare lets you add headers at the edge, which is the most secure method.

Option A — Cloudflare Transform Rules

Dashboard → Rules → Transform Rules → Modify Response Header

Option B — Cloudflare Workers

response.headers.set("X-Frame-Options", "SAMEORIGIN");
response.headers.set("X-Content-Type-Options", "nosniff");
response.headers.set("Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload");

🐘 7. PHP Fallback (Least Recommended)

Use only if you cannot modify server config:

header("X-Frame-Options: SAMEORIGIN");
header("X-Content-Type-Options: nosniff");
header("Referrer-Policy: strict-origin-when-cross-origin");
header("Permissions-Policy: geolocation=(), microphone=(), camera=()");
header("Strict-Transport-Security: max-age=31536000; includeSubDomains; preload");

⚠️ Warning: PHP headers may be overridden by the server or CDN. Use only as a last resort.

🧪 8. Testing Your Headers

Use these tools:

Look for your headers under Response Headers.

🧭 9. Best Practices

🎉 10. Summary

Security headers must be added by:

Plugins cannot safely inject them automatically, and your architecture respects that perfectly.

Omega Web Metrics → Detects

Omega Security Engine Pro → Protects

Developers → Implement headers

This is the correct, professional, enterprise‑grade model.