Fixes · Security holes

No security headers: Content-Security-Policy, HSTS and X-Frame-Options

Without security headers, other sites can frame your app to trick clicks and injected scripts run freely. Three lines of config close whole classes of attack.

What you see

A security scan or a customer's review flags missing headers, or your app can be shown inside someone else's page.

Why it happens

Browsers only enforce these protections when the server asks for them in response headers. AI tools and starter templates rarely add them, and hosts don't add most of them for you.

How to fix it

  1. Next.js: return the headers from headers() in next.config for every path (source: "/(.*)"). Vite and other static apps: set them in vercel.json, a _headers file on Cloudflare Pages, or your server.
  2. Start with Strict-Transport-Security: max-age=63072000; includeSubDomains, X-Frame-Options: DENY (or frame-ancestors 'none' in the policy), X-Content-Type-Options: nosniff and Referrer-Policy: strict-origin-when-cross-origin.
  3. Add a Content-Security-Policy last, listing the scripts, styles and connections your app really uses (your database, payments, analytics). Try it as Content-Security-Policy-Report-Only first, so nothing breaks while you tune it.
  4. Check the result in your browser's developer tools (Network, the page's response headers).

Or ask your AI tool to fix it

Paste this into Lovable, Bolt, v0, Replit or Cursor, and let it make the change.

Request for your AI tool
Add security headers to every response: Strict-Transport-Security, X-Frame-Options DENY, X-Content-Type-Options nosniff, Referrer-Policy strict-origin-when-cross-origin, and a Content-Security-Policy that allows only the scripts, styles, images and connections this app actually uses. Put them in the framework's headers config, not in individual pages.

Don't change what the app does.
Never put a secret key or password in the code: read it from an environment variable.
If a step has to be done outside the code, like revoking a key in a provider's dashboard, list it for me at the end instead of skipping it.

How Launchpad helps

The launch check looks for these headers in your code and config. Launchpad doesn't set them on your app: they belong in your code, where the request above puts them.

Check your app for this, freeStart free

Related