Cross-origin isolation for browser games

A threaded browser game needs the headers Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp, because browsers allow the shared memory its threads use (SharedArrayBuffer) only in a secure, cross-origin isolated page. Threaded Godot and Defold web builds need them, while Godot's single-threaded export, the default since 4.3, doesn't. Netlify and Cloudflare Pages send them from a _headers file and Vercel from vercel.json. Wherever the game plays, list the link on Foundplay for free.

Checked November 22, 2026. Written by Foundplay, a game discovery platform for free browser games.

Copy one of these

_headers, for Netlify or Cloudflare Pages
/*
  Cross-Origin-Opener-Policy: same-origin
  Cross-Origin-Embedder-Policy: require-corp
vercel.json, for Vercel
{
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        { "key": "Cross-Origin-Opener-Policy", "value": "same-origin" },
        { "key": "Cross-Origin-Embedder-Policy", "value": "require-corp" }
      ]
    }
  ]
}

When the host can't send them

  • Godot: since 4.3 the default web export runs on a single thread and doesn't need the headers. It can't use threads and runs slower than the threaded export. Source: Godot: Exporting for the Web.
  • Godot with threads: check Progressive Web App > Enable in the export options. A service worker stands in for the headers, and the page still needs a secure context such as https. With neither, the game won't run. Source: Godot: Exporting for the Web.
  • Defold: bundle wasm-web next to wasm_pthread-web. The loader picks the threaded engine where the page is isolated and falls back to wasm-web elsewhere; a bundle with only wasm_pthread-web can't run without isolation. Source: Defold: HTML5.
  • Files the game loads from another site must also send compatible CORS or Cross-Origin-Resource-Policy headers. Source: Defold: HTML5.
  • To check, type crossOriginIsolated in the browser console on the hosted page. It's true when the page is isolated. Source: MDN: crossOriginIsolated.

Sending the headers, host by host

  • Netlify

    How to send them
    A plain text _headers file, or [[headers]] tables in netlify.toml
    Where the file goes
    The _headers file goes in the folder you publish
    Watch for
    Headers apply only to files Netlify serves itself, not to functions or proxied content. A custom Content-Encoding header is typically ignored.

    Sources: Custom headers, netlify.toml

    Checked November 22, 2026.

  • Cloudflare Pages

    How to send them
    A plain text _headers file, with no file extension
    Where the file goes
    In the folder of files you deploy, such as the build output directory
    Watch for
    Up to 100 header rules, each line up to 2,000 characters. Not applied to responses from Pages Functions.

    Sources: Headers

    Checked November 22, 2026.

  • Vercel

    How to send them
    A headers list in vercel.json, each with a source pattern and key and value pairs
    Where the file goes
    vercel.json in the project's root directory
    Watch for
    Each header rule counts toward the 2,048 routes a deployment can have.

    Sources: vercel.json headers, Limits

    Checked November 22, 2026.

  • GitHub Pages

    Sources: Limits

    Checked November 22, 2026.

  • itch.io

    Sources: HTML5 games

    Checked November 22, 2026.

Questions

Why does my threaded web game need special headers?
Threads share memory through SharedArrayBuffer, which browsers allow only in a secure, cross-origin isolated page. A page is isolated when it arrives with Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp or credentialless.
How do I set COOP and COEP headers on Netlify?
Put a plain text _headers file in the folder you publish, or add [[headers]] tables to netlify.toml. The headers apply to files Netlify serves itself, not to functions.
How do I set COOP and COEP headers on Cloudflare Pages?
Put a plain text _headers file, with no extension, in the folder of files you deploy. Pages Functions responses don't get these headers.
How do I set COOP and COEP headers on Vercel?
Add a headers list to vercel.json in the project's root directory, with a source pattern such as /(.*) and the two headers as key and value pairs.
What if my host can't send these headers?
Export without threads: Godot's single-threaded export is the default since 4.3. A threaded Godot export can turn on Progressive Web App > Enable, a service worker that stands in for the headers on a secure page. A Defold bundle can include wasm-web as a fallback.
How do I check that my game's page is cross-origin isolated?
Open the hosted page, then type crossOriginIsolated in the browser console. It's true when the page is isolated.

More for makers: Where to upload your HTML5 game, Browser game file size limits, Make your browser game work on phones, Make your browser game load faster, Embed a browser game on your site and Submit a game to Foundplay.