Back to Scanner
Copy-Paste Configurations

Security Headers Fix Generator

Generate production-ready security header configurations for your web server or framework. Select your platform and copy the complete configuration — no manual editing required.

Select Platform

Web Servers

CDN & Cloud

Frameworks

Nginx
# Add inside your server {} block in nginx.conf or site config

server {
    listen 443 ssl http2;
    server_name yourdomain.com;

    # ── Security Headers ──────────────────────────────────────
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
    add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self'; frame-ancestors 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests;" 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;
    add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always;
    add_header Cross-Origin-Opener-Policy "same-origin" always;
    add_header Cross-Origin-Resource-Policy "same-origin" always;

    # ── Remove Server Version Information ─────────────────────
    server_tokens off;

    # ── Remove X-Powered-By from proxied upstream apps ─────────
    proxy_hide_header X-Powered-By;

    # Note: Nginx cannot fully remove its own Server header without a custom build.
    # server_tokens off hides the version and is safe on stock Nginx.

    # ── Force HTTPS Redirect ──────────────────────────────────
    # (Put this in your port 80 server block)
    # return 301 https://$host$request_uri;
}

Before deploying: Test in a staging environment first. Content-Security-Policy may break third-party scripts, analytics, and payment gateways. Start with Report-Only mode for CSP.

Nginx

Apache

IIS

Cloudflare

Express.js

Next.js

Scan your site first

Use the scanner to identify exactly which headers are missing before applying fixes.

Scan My Website