How to Configure Strict Cross-Origin Embedder Policy (COEP) Reporting in Google Chrome

Achieving cross-origin isolation in modern web browsers unlocks high-performance APIs such as SharedArrayBuffer, high-resolution performance timers, and WebAssembly multi-threading. However, immediately enforcing Cross-Origin-Embedder-Policy: require-corp on a complex enterprise website often breaks critical third-party integrations (such as embedded payment widgets, analytics beacons, font CDNs, and media players) that lack explicit CORP headers. The W3C Reporting API and COEP Report-Only mode allow web engineering teams to collect real-time JSON violation telemetry in Google Chrome, pinpointing unannotated subresources before enforcing blocking rules.

Understanding COEP Violation Mechanisms and Reporting Endpoints

Chromium evaluates cross-origin subresources against the document’s embedder policy:

  • Cross-Origin-Embedder-Policy-Report-Only: require-corp: Evaluates all subresource fetches against CORP rules without blocking requests. When a subresource fails (e.g., missing Cross-Origin-Resource-Policy or CORS opt-in), Chrome allows the resource to render while dispatching a structured JSON violation report.
  • Reporting-Endpoints: The modern HTTP response header replacing the legacy Report-To header. Binds reporting endpoint names to explicit collector URLs.
  • report-to=[endpointName]: Directive appended to the COEP header designating which registered endpoint receives reports.
  • coep: credentialless: An alternative mode that strips credentials from subresource requests without requiring explicit CORP headers from third-party hosts.

Configuring Server Headers in Nginx and Caddy

Configure your edge proxy to declare reporting endpoints and activate COEP report-only mode:

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

    # Declare modern Reporting-Endpoints collector
    add_header Reporting-Endpoints "coep-reports="https://telemetry.example.com/reports/coep"" always;

    # Run COEP in Report-Only mode
    add_header Cross-Origin-Embedder-Policy-Report-Only "require-corp; report-to="coep-reports"" always;
    add_header Cross-Origin-Opener-Policy-Report-Only "same-origin; report-to="coep-reports"" always;

    # Security baseline
    add_header X-Content-Type-Options "nosniff" always;

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

Inspecting COEP Telemetry Reports in JavaScript

In addition to network collector endpoints, frontend developers can intercept violation reports client-side using the ReportingObserver API:

// 1. Initialise client-side ReportingObserver for COEP reports
if ('ReportingObserver' in window) {
    const observer = new ReportingObserver((reports, obs) => {
        for (const report of reports) {
            if (report.type === 'coep') {
                console.warn("COEP Violation Detected:", {
                    url: report.body.blockedURL,
                    type: report.body.type,
                    disposition: report.body.disposition // 'reporting' or 'enforce'
                });

                // Forward telemetry to local logging agent
                navigator.sendBeacon('/api/telemetry/coep-violation', JSON.stringify(report.body));
            }
        }
    }, { types: ['coep'], buffered: true });

    observer.observe();
} else {
    console.info("ReportingObserver API not supported in this browser.");
}

Debugging COEP Violations in Chrome DevTools

Google Chrome provides built-in panels to inspect and debug COEP reports during development:

  1. Open Google Chrome, navigate to your web application, and open DevTools via F12.
  2. Select the Application panel and locate the Background Services section in the left sidebar.
  3. Click on Reporting API.
  4. DevTools lists all registered endpoints defined by the Reporting-Endpoints header alongside queued and delivered reports.
  5. Switch to the Issues tab in the bottom drawer; Chrome highlights blocked subresources under Cross-Origin Embedder Policy Issues, providing direct links to the offending script or image tag and suggesting remediation actions (e.g., adding crossorigin="anonymous" or applying for a third-party CORS header).

Remediating Subresource Failures for Full Enforcement

Once telemetry reports reach zero, transition from report-only to strict enforcement:

Cross-Origin-Embedder-Policy: require-corp; report-to="coep-reports"
Cross-Origin-Opener-Policy: same-origin; report-to="coep-reports"

For cross-origin assets (such as images on an external CDN) that cannot add CORS, configure the CDN to serve Cross-Origin-Resource-Policy: cross-origin, granting explicit embedder permission.

Get the best tech tips delivered straight to your inbox.

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