FREEFirst project with us? Your landing page design is on the house.See the offer

Process

Security headers for a marketing site: which ones to set and where

Six security headers worth setting on a marketing site, what each one does, a safe starting set, and how to add them on Vercel, Netlify, Cloudflare and Webflow.

By Abdul QuadirUpdated 2026-11-167 min read
TL;DR
  • Set six headers: Strict-Transport-Security, X-Content-Type-Options, a framing rule, Referrer-Policy, Permissions-Policy and a Content-Security-Policy.
  • The first five are one line each. The Content Security Policy needs testing, so start it in report-only mode.
  • On Vercel they go in vercel.json. Netlify and Cloudflare Pages read a _headers file.
  • On Webflow, HSTS is on for you and secure frame headers is a switch. Other custom headers need an Enterprise plan.
  • Check the result in your browser: DevTools, Network panel, the page request, response headers.

The short answer

A marketing site should send six security headers: Strict-Transport-Security, X-Content-Type-Options, a framing rule (X-Frame-Options or a CSP frame-ancestors rule), Referrer-Policy, Permissions-Policy and a Content-Security-Policy. The first five are one line each and rarely break anything. The Content Security Policy takes more care, so add it last and test it in report-only mode first.

You set them where your site is hosted: vercel.json on Vercel, a _headers file on Netlify and Cloudflare Pages, and Site settings on Webflow, where the options depend on your plan.

What a security header is

Every time a browser asks for a page, the server answers with the page and a list of response headers. Some of those headers are instructions to the browser: only use HTTPS here, do not show this page inside a frame, only run scripts from these places. The browser enforces them for you.

They do not replace safe code, safe forms or an SSL certificate. They are a second layer that costs a few lines of host settings.

The six headers, one by one

  • Strict-Transport-Security (HSTS). Tells the browser to reach your site only over HTTPS and to upgrade any later HTTP attempt on its own. max-age is how long, in seconds, the browser remembers this. MDN notes two things worth knowing: browsers ignore the header when it arrives over plain HTTP, and on an HSTS site a visitor cannot click past a certificate error. See MDN on HSTS.
  • X-Content-Type-Options. Its only value is nosniff. It tells the browser to trust the file type the server declares and not guess. The browser then blocks a script or stylesheet whose declared type does not match. See MDN.
  • X-Frame-Options and frame-ancestors. Both control whether another site can show your page inside a frame, which is how clickjacking works. X-Frame-Options takes DENY or SAMEORIGIN. The CSP rule frame-ancestors 'none' is similar to DENY, and it can also list the sites that are allowed to embed you. MDN says X-Frame-Options in a meta tag has no effect, and frame-ancestors is not supported in a meta tag either. Both must be real headers. See MDN on X-Frame-Options and frame-ancestors.
  • Referrer-Policy. Controls how much of your page address is sent along when a visitor clicks to another site or the page loads a file. With strict-origin-when-cross-origin, your own site gets the full address, other HTTPS sites get only your domain, and nothing is sent to a plain HTTP site. MDN lists this value as the default when no policy is set, so sending it makes the choice explicit. See MDN.
  • Permissions-Policy. Allows or denies browser features such as the camera, microphone and location, for your page and for any iframe inside it. camera=() turns the camera off for everything on the page. MDN marks this header as experimental and not supported in every major browser, so treat it as an extra, not a guarantee. See MDN.
  • Content-Security-Policy (CSP). Controls which resources the browser may load for the page: scripts, styles, images, frames and more. MDN describes it as a guard against cross-site scripting. It is the strongest header on this list and the one most likely to break a page if you get it wrong. See MDN on CSP.

A safe starting set

These six lines are a sensible start for a marketing site that is fully on HTTPS and is not meant to be embedded on other sites:

Strict-Transport-Security: max-age=31536000
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Content-Security-Policy: frame-ancestors 'none'
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()

Before you copy them, check three things:

  • HSTS length. 31536000 is one year. Browsers keep the rule for that long, so be sure the whole domain stays on HTTPS.
  • Subdomains and preload. You can add includeSubDomains and preload. MDN says the preload list needs a max-age of at least one year plus includeSubDomains. Add them only when every subdomain you own works over HTTPS, because the rule will apply to all of them.
  • Framing. If your own site embeds its own pages in a frame, use SAMEORIGIN and frame-ancestors 'self'. If partners embed your pages, list them in frame-ancestors.

The Content-Security-Policy line above only covers framing. A full policy that also limits scripts comes later in this post.

How to set them on Vercel

On Vercel, headers go in the headers array of vercel.json. Each entry has a source pattern that matches the path and a list of key and value pairs. This is the shape in Vercel's vercel.json docs:

{
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        { "key": "Strict-Transport-Security", "value": "max-age=31536000" },
        { "key": "X-Content-Type-Options", "value": "nosniff" },
        { "key": "X-Frame-Options", "value": "DENY" },
        { "key": "Content-Security-Policy", "value": "frame-ancestors 'none'" },
        { "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" },
        { "key": "Permissions-Policy", "value": "camera=(), microphone=(), geolocation=()" }
      ]
    }
  ]
}

Commit the file and deploy. The source /(.*) matches every path. Our own site sets its headers this way.

How to set them on Netlify and Cloudflare Pages

Netlify and Cloudflare Pages both read a plain text file called _headers. The format is a path on one line and the headers indented below it:

/*
  Strict-Transport-Security: max-age=31536000
  X-Content-Type-Options: nosniff
  X-Frame-Options: DENY
  Content-Security-Policy: frame-ancestors 'none'
  Referrer-Policy: strict-origin-when-cross-origin
  Permissions-Policy: camera=(), microphone=(), geolocation=()
  • Netlify. Save _headers to the publish directory, the folder that gets deployed. You can also use [[headers]] tables in netlify.toml. One limit from Netlify's docs: custom headers apply only to files Netlify serves itself. A page rendered by a function or proxied from elsewhere has to send its own headers.
  • Cloudflare Pages. Put _headers in your static asset directory, which is often public/ when you use a framework. Cloudflare's docs allow up to 100 header rules and 2,000 characters per line, and the file does not apply to responses from Pages Functions. Set those headers in the function code.

Picking a host? Our comparison of Vercel, Netlify and Cloudflare for an Astro site covers the rest. Keep your headers in one list and a later move is mostly a change of file format.

What Webflow hosting lets you control

On Webflow you do not edit a headers file. What you can change depends on the plan, and Webflow's help pages spell it out:

  • HSTS. Webflow turns the HSTS header on for all non-Enterprise sites and it cannot be turned off. Under Site settings, Publishing, Advanced publishing options you can also switch on HSTS for subdomains and the preload header. Webflow warns that preload with subdomains can make a site unreachable if any subdomain still uses HTTP.
  • Framing. The same panel has "Use secure frame headers", which adds headers that stop your pages from being embedded in iframes.
  • Everything else. Custom security headers are for Webflow Enterprise customers only. The supported list includes content-security-policy, x-content-type-options, x-frame-options and referrer-policy. Webflow says it does not support permissions-policy there and advises feature-policy in its place.

So on a standard Webflow plan, check that secure frame headers is on and accept that the rest is set by Webflow. The settings are described in Webflow's Advanced publishing options help page. If you need full control of headers, that is one reason teams choose Enterprise or a code-based site such as Astro and Sanity.

Content Security Policy: go slowly

A full CSP lists where scripts, styles, images and frames may come from. A marketing site usually loads a tag manager, analytics, fonts, a video player and a booking widget, and each one needs to be allowed. Miss one and it stops working.

  1. List what the site loads. Open the Network tab in your browser and note every outside domain.
  2. Start in report-only mode. The Content-Security-Policy-Report-Only header reports what a policy would block without blocking it. MDN describes it as the way to test a policy.
  3. Avoid 'unsafe-inline' for scripts. MDN describes two ways to allow your own inline scripts: a nonce, a random value the server creates for each response, or a hash of the script. Hashes suit static sites, because the pages do not change between builds.
  4. Then enforce. Switch to the real header and click through every page, form and popup.

You can also send a CSP in a meta tag, which helps when you cannot change headers. The framing rule will not work there, as noted above. On our own site, each page carries a CSP meta tag with the hashes of its own inline scripts, written at build time, and the other headers come from the host.

How the Forbes Cloud 100 do it

We read the home page headers of every company on the list for our study, Do top cloud companies send security headers? (Forbes Cloud 100, checked 16 November 2026). Three figures from it:

  • 92% of the 99 home pages we could read force HTTPS with Strict-Transport-Security.
  • 69% send a Content Security Policy.
  • 49% send all four basic headers: HSTS, a CSP, framing protection and X-Content-Type-Options.

The study counts headers on one home page on one day. A missing header is not proof a site is unsafe. It does show that the CSP is where most teams stop.

How to check your own site

  1. Open your live site in Chrome and open DevTools, then the Network panel.
  2. Reload the page and select the first request in the list, the page itself.
  3. Open the Headers tab and scroll to the response headers. Chrome's Network panel reference shows where they sit.
  4. Compare what you see with the six headers above.
  5. Check a second page type too, such as a blog post or a page rendered by a function. Hosts can treat them differently.
  6. After adding a CSP, open the Console. Blocked resources show up there as errors.

Headers are one of the small jobs that get missed after launch. Our post on what breaks after launch lists the others.

Want us to set them up or check them? Headers are part of our builds on Webflow and Astro, and of the care plan. Or send us your site.

Abdul Quadir
Abdul QuadirFounder of Kookies. Builds Webflow and Astro sites for startups and growing teams.

Terms used: Webflow, Vercel

FAQs

Questions
people ask.

Abdul Quadir
Still have a question?Ask us directly. We reply within a day.
Book a callPick a timehello@kookies.io

Strict-Transport-Security, X-Content-Type-Options, a framing rule (X-Frame-Options or CSP frame-ancestors), Referrer-Policy, Permissions-Policy and a Content-Security-Policy. Add the CSP last and test it first.

In the headers array of vercel.json. Each entry has a source pattern for the path and a list of key and value pairs. Deploy to apply them.

Both read a plain text file called _headers with a path and indented headers below it. Netlify reads it from the publish directory, Cloudflare Pages from the static asset directory.

Only on Webflow Enterprise. On other plans Webflow turns HSTS on for you, and you can switch on secure frame headers under Advanced publishing options.

They do a similar job. MDN notes X-Frame-Options is also supported in older browsers, and frame-ancestors is more flexible. MDN's own example sends both. Neither works in a meta tag.

It can, if a script or widget you use is not on the allowed list. Test with the Content-Security-Policy-Report-Only header first, then enforce it.

Your turn

Let's kook
what you krave.

Hi Kookies, I need a built on . I'd love to launch . Reach me at
or book a callSent. We reply within one working day.