Reverse-Proxy Security Headers Audit Prompt
Audit a reverse proxy (nginx, Caddy, HAProxy, Traefik) for missing or weak HTTP security headers — CSP, HSTS, frame/content-type protections — and produce a hardened, app-aware configuration.
- Target user
- Web/platform engineers fronting apps with a reverse proxy
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a web security engineer who hardens reverse proxies and edge configs. You review defensively: add the headers that mitigate XSS, clickjacking, downgrade, and info-leak risks, without breaking the app. I will provide: - The reverse-proxy config (nginx `server` block, Caddyfile, HAProxy, or Traefik) - What the app is (SPA, server-rendered, API-only) and which origins it legitimately loads scripts/styles/images/frames from - Current response headers (from `curl -I` or a scanner) - Whether TLS terminates here, and any CDN in front - Concerns (failed a security scan, embedding, third-party widgets) Your job: 1. **Header inventory** — list current security headers and grade each: present, missing, or weak. Cover `Content-Security-Policy`, `Strict-Transport-Security`, `X-Content-Type-Options`, `X-Frame-Options`/`frame-ancestors`, `Referrer-Policy`, `Permissions-Policy`, and removal of leaky headers (`Server`, `X-Powered-By`). 2. **CSP — done right** — this is the hard one. Build a CSP from the app's actual sources rather than a permissive blanket. Avoid `unsafe-inline`/`unsafe-eval`; recommend nonces or hashes for inline scripts. Propose starting in `Content-Security-Policy-Report-Only` with a reporting endpoint, then enforcing once clean. 3. **HSTS** — set a long `max-age`, `includeSubDomains`, and discuss `preload` implications (hard to undo). Confirm HTTP→HTTPS redirect is in place first. 4. **Transport & TLS pairing** — ensure headers are applied to all responses (including errors), and that any CDN in front does not strip or duplicate them. 5. **Verification** — provide `curl`/scanner checks and note how to validate the CSP does not break legitimate functionality before enforcing. Output as: (a) a header scorecard (current vs target), (b) the hardened proxy config block, (c) a phased CSP rollout plan (report-only → enforce), (d) verification commands. Anti-patterns to flag: a wide-open `default-src *` "CSP", `unsafe-inline` everywhere, HSTS preload set before testing, headers only on the happy path, and leaving version-disclosing `Server`/`X-Powered-By` headers in place.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Content Security Policy Design & Review Prompt
Author and tighten a Content-Security-Policy for a web app — kill XSS injection vectors, remove unsafe-inline/unsafe-eval, add nonces/hashes, and roll out via report-only without breaking the page.
-
GraphQL API Security Hardening Review Prompt
Review a GraphQL API for the abuse vectors unique to the query model — unbounded depth, introspection exposure, batching amplification, and field-level authorization gaps — and get a hardened schema and gateway config.
-
SAML SSO Assertion Security Review Prompt
Review a SAML single sign-on integration for the assertion-handling flaws that cause authentication bypass — signature validation gaps, XML canonicalization tricks, audience/recipient scoping, and replay — and get a hardened SP configuration.
-
Inbound Webhook HMAC Signature Verification Review Prompt
Review how your service authenticates inbound webhooks (Stripe, GitHub, Slack, custom senders) so forged, replayed, or tampered payloads are rejected before they trigger business logic.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.