Amblem
Furkan Baytekin

What Are COOP, COEP, and CORP Headers? (And Why Browsers Needed Them)

COOP COEP CORP security headers explained

What Are COOP, COEP, and CORP Headers? (And Why Browsers Needed Them)
78
4 minutes

Before talking about headers, you need to understand the problem they were created to solve.


The Real Problem: What Is Spectre?

Spectre is a class of security vulnerabilities discovered in 2018 that affects modern CPUs, not just browsers.

In simple terms:

In the browser world, this means:

A malicious website could potentially infer data from another website opened in the same browser.

Passwords, tokens, private data — all at risk.

Browsers needed a strong isolation model, not just “best effort” sandboxing.


The Solution: Cross-Origin Isolation

Browsers introduced a concept called cross-origin isolation.

Goal: Make sure one website cannot observe or interact with another website’s memory or execution environment.

To enforce this, browsers added three new security headers:

They work together, not separately.


COOP: Cross-Origin-Opener-Policy

What it is: COOP controls how your page relates to other tabs or windows.

What Problem It Solves

Without COOP:

With COOP:

Example:

http
Cross-Origin-Opener-Policy: same-origin

What This Means


COEP: Cross-Origin-Embedder-Policy

What it is: COEP controls which external resources your page is allowed to load.

The Core Idea

If you want strong isolation, you must be strict about embeds.

http
Cross-Origin-Embedder-Policy: require-corp

What This Does

Why Browsers Enforce This

If arbitrary third-party resources could be embedded, isolation would be meaningless.


CORP: Cross-Origin-Resource-Policy

What it is: CORP is a header sent by the resource itself, not the embedding page.

It tells browsers:

“Who is allowed to load this resource?”

Example:

http
Cross-Origin-Resource-Policy: same-origin

Common Values

Value Meaning
same-origin Only this origin can load it
same-site Subdomains allowed
cross-origin Anyone can load it

This is how CDNs and asset servers opt-in to COEP-protected pages.


How COOP, COEP, and CORP Work Together

Here’s the clean mental model:

Full Cross-Origin Isolation Setup

http
Cross-Origin-Opener-Policy: same-origin Cross-Origin-Embedder-Policy: require-corp

And assets respond with:

http
Cross-Origin-Resource-Policy: same-origin

When all three align, the browser guarantees:


Why Enabling These Headers Often Breaks Sites

This is where most devs get burned.

Common breakages:

Why? Because those resources don’t send CORP or CORS headers.

Typical Fixes


When You Actually Need COOP and COEP

You need them if you use:

You don’t need them for:

Isolation has a cost.


Example: Nginx Configuration

nginx
add_header Cross-Origin-Opener-Policy "same-origin" always; add_header Cross-Origin-Embedder-Policy "require-corp" always;

For static assets:

nginx
add_header Cross-Origin-Resource-Policy "same-origin";

Final Takeaway

COOP, COEP, and CORP are not optional “security extras”. They are the browser’s answer to hardware-level vulnerabilities like Spectre.

If you’re building serious, performance-heavy web apps, you design with them in mind. If not, don’t enable them blindly.


Album of the blog:

Suggested Blog Posts