How to Configure Cross-Origin Opener Policy (COOP) Same-Origin Plus COEP in Google Chrome

Modern browser security models enforce cross-origin isolation to prevent speculative side-channel attacks such as Spectre from leaking sensitive cross-origin memory across thread boundaries. By combining the Cross-Origin-Opener-Policy: same-origin (COOP) and Cross-Origin-Embedder-Policy: require-corp (COEP) response headers, web applications create a sandboxed execution boundary. This cross-origin isolated environment grants access to powerful, high-performance web capabilities—such as SharedArrayBuffer, high-resolution performance.now() timestamps, and WebAssembly multi-threading—without security compromises.

Understanding COOP and COEP Synergies

Cross-origin isolation requires both the opener policy and embedder policy to be strictly defined:

  • Cross-Origin-Opener-Policy: same-origin: Isolates your browsing context group. Top-level documents from other origins opened via links or window.open() reside in a distinct process and cannot access your window object via window.opener.
  • Cross-Origin-Embedder-Policy: require-corp: Guarantees that the document cannot load any cross-origin subresources (such as images, scripts, stylesheets, or media) unless the resource explicitly opts in via Cross-Origin Resource Policy (Cross-Origin-Resource-Policy: cross-origin) or CORS.
  • Cross-Origin-Embedder-Policy: credentialless: An alternative embedder mode that omits credentials (cookies and HTTP auth) from subresource requests without requiring explicit CORP headers from third-party hosts.

Configuring Server Headers in Nginx and Apache

Configure your web server to emit the required security headers across all HTML documents and subresources:

# Nginx Server Block Configuration
server {
    listen 443 ssl http2;
    server_name compute.example.com;

    # Enforce strict cross-origin isolation
    add_header Cross-Origin-Opener-Policy "same-origin" always;
    add_header Cross-Origin-Embedder-Policy "require-corp" always;

    # Defend against MIME-type sniffing and framing
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "SAMEORIGIN" always;

    location / {
        proxy_pass http://backend_compute_upstream;
        proxy_set_header Host $host;
    }
}

Verifying Cross-Origin Isolation in Google Chrome

To confirm that Google Chrome has entered cross-origin isolated mode:

  1. Navigate to your web application in Google Chrome.
  2. Press F12 to open Chrome DevTools and select the Console tab.
  3. Query the native window isolation boolean:
    console.log(window.crossOriginIsolated);
    If cross-origin isolation is successfully configured, the console returns true.
  4. Verify that high-performance multi-threading constructs can be allocated without runtime errors:
    const sab = new SharedArrayBuffer(1024);
    console.log("SharedArrayBuffer allocated successfully:", sab.byteLength);
  5. Inspect window.opener when opening popups; confirm that references across origins resolve to null.

Debugging Subresource CORP Failures with DevTools

If third-party images or scripts fail to load under require-corp, open the Issues tab in DevTools:

  • Locate issues under Blocked cross-origin subresources.
  • Chrome specifies whether the failure stems from a missing Cross-Origin-Resource-Policy header or an unauthenticated CORS handshake.
  • To allow cross-origin assets on CDN endpoints, configure the external CDN to return:
    Cross-Origin-Resource-Policy: cross-origin

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.