App Investigators scanner online

← All guides

Security headers for AI-built apps: what to add and how

Response headers are short instructions your server sends with every page. A few of them tell the browser to be stricter about what your page can do. Many new apps ship without them because nothing visibly breaks.

The four to start with

Strict-Transport-Security (HTTPS only) and Permissions-Policy are also worth adding once these are in place.

How to check yours

  1. Open the developer tools (F12) and the Network tab.
  2. Reload the page and click the first request, usually your page's address.
  3. Read the Response Headers. Look for the four names above.

Netlify and Cloudflare Pages

Create a file named _headers in your publish folder:

_headers

/*
  X-Content-Type-Options: nosniff
  X-Frame-Options: DENY
  Referrer-Policy: strict-origin-when-cross-origin
  Content-Security-Policy-Report-Only: default-src 'self'; frame-ancestors 'none'

Vercel

vercel.json

{
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        { "key": "X-Content-Type-Options", "value": "nosniff" },
        { "key": "X-Frame-Options", "value": "DENY" },
        { "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" }
      ]
    }
  ]
}

Next.js and Express

next.config.js

module.exports = {
  async headers() {
    return [{
      source: "/(.*)",
      headers: [
        { key: "X-Content-Type-Options", value: "nosniff" },
        { key: "X-Frame-Options", value: "DENY" },
        { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
      ],
    }];
  },
};

Express (with the helmet package)

import helmet from "helmet";
app.use(helmet());

Take the Content Security Policy slowly

A strict policy can block your own scripts, fonts or analytics. Start with Content-Security-Policy-Report-Only, open your app, watch the browser console for what would have been blocked, adjust, and only then switch to the enforcing header. Test sign-in and payment pages especially.

Common questions

Do security headers make my app secure?

No. They remove some common ways of attacking a page, and they cost almost nothing to add. They are one layer among many.

Want this checked on your app?

The free quick look and the complete check both read your response headers and cookie settings, and report which of the basic ones are missing.

We email you once when a spot opens. No spam, and you can ask us to remove you any time at support@appinvestigators.com.

Related guides

Last updated 2026-11-24. This guide describes common problems and fixes. It is not a guarantee that any app is secure or free of bugs.