Cross-Origin-Embedder-Policy
Cross-Origin-Embedder-Policy (COEP) is an HTTP security header that controls which cross-origin resources a document is allowed to load. When set to require-corp, it requires that all cross-origin resources explicitly opt in via the Cross-Origin-Resource-Policy (CORP) header or CORS. Together with Cross-Origin-Opener-Policy (COOP), COEP enables a security state called cross-origin isolation.
Results in 1–3 minutes · Free · No signup required
Why It Matters
COEP and COOP together enable cross-origin isolation, which protects your page from Spectre-type CPU side-channel attacks. These attacks exploit speculative execution in modern CPUs to read memory across process boundaries — potentially leaking sensitive data from other browser tabs or extensions. Without cross-origin isolation, browsers intentionally reduce the precision of timers like performance.now() and disable SharedArrayBuffer to prevent Spectre exploitation. If your application needs high-resolution timers or SharedArrayBuffer (common in WebAssembly workloads, video processing, or audio apps), you must achieve cross-origin isolation by deploying both COEP and COOP headers.
How We Check
We analyze your HTTP response headers for the Cross-Origin-Embedder-Policy header and verify its value is either require-corp (strict: all cross-origin resources must have CORP headers) or credentialless (more permissive: cross-origin requests are sent without credentials). We also check for consistency with your Cross-Origin-Opener-Policy header to confirm your site achieves full cross-origin isolation, which requires both headers set correctly.
Good vs Bad Values
| Value | Verdict | Why |
|---|---|---|
Cross-Origin-Embedder-Policy: require-corp | Good | Every cross-origin resource must opt in through CORS or a Cross-Origin-Resource-Policy header. Strictest option and, together with COOP, grants cross-origin isolation. |
Cross-Origin-Embedder-Policy: credentialless | Good | No-cors cross-origin requests are sent without cookies, so third-party assets do not need CORP. Easier to deploy, with less universal browser support than require-corp. |
Cross-Origin-Embedder-Policy: Require-Corp | Good | Values are matched case-insensitively by the scanner. Keep them lowercase to match the specification. |
Cross-Origin-Embedder-Policy-Report-Only: require-corp | Weak | A staging tool: violations are reported, nothing is blocked. It does not enforce, and the scanner reads only the enforcing header. |
Cross-Origin-Embedder-Policy: unsafe-none | Bad | The default, spelled out. Cross-origin resources load freely and the page cannot be cross-origin isolated. |
Cross-Origin-Embedder-Policy: require_corp | Bad | A typo with an underscore. Browsers ignore unknown values, so the page has no embedder policy at all. |
Cross-Origin-Embedder-Policy: same-origin | Bad | This is a COOP/CORP value, not a COEP one. It is invalid here and ignored. |
Cross-Origin-Embedder-Policy: require-corp with third-party images lacking CORP | Weak | Policy is correct, but those images no longer render. Add CORS/CORP at the source, proxy them, or switch to credentialless. |
Header missing | Bad | The page cannot reach cross-origin isolation, and SharedArrayBuffer stays unavailable. |
How to Fix
Add the COEP header to your server responses alongside COOP:
Option 1: require-corp (strictest isolation) Cross-Origin-Embedder-Policy: require-corp Cross-Origin-Opener-Policy: same-origin
With require-corp, every cross-origin resource (scripts, images, fonts, iframes) must include one of:
- Cross-Origin-Resource-Policy: cross-origin
- CORS headers: Access-Control-Allow-Origin
Option 2: credentialless (easier to adopt) Cross-Origin-Embedder-Policy: credentialless Cross-Origin-Opener-Policy: same-origin
With credentialless, cross-origin requests are sent without cookies or credentials, so most third-party resources load without changes.
Testing before enabling: Use report-only mode to identify incompatible resources without breaking your site: Cross-Origin-Embedder-Policy-Report-Only: require-corp; report-to="default"
Check browser DevTools > Application > Cross-Origin Isolation to verify your isolation status after deployment.
Nginx:
add_header Cross-Origin-Embedder-Policy "require-corp" always;
add_header Cross-Origin-Opener-Policy "same-origin" always;
Apache (requires mod_headers):
Header always set Cross-Origin-Embedder-Policy "require-corp"
Header always set Cross-Origin-Opener-Policy "same-origin"
Next.js — next.config.js:
async headers() {
return [{
source: "/(.*)",
headers: [
{ key: "Cross-Origin-Embedder-Policy", value: "credentialless" },
{ key: "Cross-Origin-Opener-Policy", value: "same-origin" },
],
}];
}
Express: helmet({ crossOriginEmbedderPolicy: { policy: "require-corp" } }). Recent Helmet versions leave COEP off by default, so you have to enable it. Cloudflare: Rules → Transform Rules → Modify Response Header.
Staged rollout. Start in report-only mode and collect reports:
add_header Cross-Origin-Embedder-Policy-Report-Only 'require-corp; report-to="coep"' always;
add_header Reporting-Endpoints 'coep="https://example.com/reports"' always;
Make a third-party resource compatible. For a file you control on another host, add Cross-Origin-Resource-Policy: cross-origin to its responses. For a file you do not control, load it with crossorigin="anonymous" if the host supports CORS, or use credentialless.
Verify with curl -sI https://example.com | grep -i cross-origin-embedder-policy, then run window.crossOriginIsolated in the browser console. It returns true only when COEP and COOP are both in place.
Common Mistakes
- Enabling COEP without COOP. Isolation needs both: COEP alone only restricts embedded resources and gives no `crossOriginIsolated` state.
- Deploying `require-corp` site-wide in one go. Every third-party image, script, font, video and iframe without CORP or CORS is blocked; stage it with `Cross-Origin-Embedder-Policy-Report-Only` first.
- Forgetting the `crossorigin` attribute. A cross-origin `<script>` or `<img>` served with proper CORS headers still counts as no-cors unless the element carries `crossorigin`.
- Forgetting nested content: iframes must themselves send a compatible COEP (or be loaded with `credentialless` mode), otherwise the frame is blocked.
- Adding it because a checklist says to. Unless you need SharedArrayBuffer or precise timers, COEP is optional, and it can break ads, maps, social embeds and payment widgets.
- Assuming `credentialless` is supported everywhere. Test in your target browsers; where unsupported, the header is ignored and isolation is not granted.
Frequently Asked Questions
What is Cross-Origin-Embedder-Policy?
Cross-Origin-Embedder-Policy (COEP) is an HTTP security header that controls which cross-origin resources a document is allowed to load. When set to require-corp, it requires that all cross-origin resources explicitly opt in via the Cross-Origin-Resource-Policy (CORP) header or CORS. Together with Cross-Origin-Opener-Policy (COOP), COEP enables a security state called cross-origin isolation.
Why does Cross-Origin-Embedder-Policy matter for website security?
COEP and COOP together enable cross-origin isolation, which protects your page from Spectre-type CPU side-channel attacks. These attacks exploit speculative execution in modern CPUs to read memory across process boundaries — potentially leaking sensitive data from other browser tabs or extensions. Without cross-origin isolation, browsers intentionally reduce the precision of timers like performance.now() and disable SharedArrayBuffer to prevent Spectre exploitation. If your application needs high-resolution timers or SharedArrayBuffer (common in WebAssembly workloads, video processing, or audio apps), you must achieve cross-origin isolation by deploying both COEP and COOP headers.
How do I fix Cross-Origin-Embedder-Policy issues?
Add the COEP header to your server responses alongside COOP:
Related Security Checks
Check Your Website Now
Run a free security scan to check for Cross-Origin-Embedder-Policy issues and 61 other security checks.
Scan Your Website Free