Why doesn't Reporting-Endpoints work on Chrome localhost?

Stuart Larsen · #article7 days ago

Overview

As of testing in November 2026, you can't use Reporting-Endpoints on Chrome over http://localhost due to a spec mismatch issue in Chrome. Unfortunately, setting report-to also blocks the report-uri fallback.

Firefox handles this case correctly.

If you're setting up CSP with Chrome and using http://localhost:port as your development server, I'd recommend avoiding Reporting-Endpoints for now and sticking to report-uri.

What does the spec say?

From the W3C Reporting API spec (Header):

Moreover, the URL that the member's value represents MUST be potentially trustworthy [SECURE-CONTEXTS]. Non-secure endpoints will be ignored.

And from Process reporting endpoints for response:

Abort these steps if response's HTTPS state is not "modern", and the origin of response's url is not potentially trustworthy.

So both the responding origin and the reporting endpoints must be "potentially trustworthy".

"Potentially trustworthy" is defined in the W3C Secure Contexts spec, which explicitly includes http://localhost (step 5).

So according to the spec, yes, http://localhost should be allowed.

Testing

I set up a small Flask server with the following route:

app.py

@app.route("/")
def home():
    # ORIGIN = "https://1e3d-68-42-94-236.ngrok-free.app"
    ORIGIN = "http://localhost:5000"

    headers = {
        "Reporting-Endpoints": f'csp="{ORIGIN}/csp"',
        "Content-Security-Policy": "script-src 'none'; report-to csp;"
    }

    return render_template("./index.html"), headers

index.html

<html><body><script>alert(1)</script></body></html>

In Chrome, we can check DevTools -> Application -> Reporting API to see if the reporting endpoint is being pinned and whether reports are being sent. In Firefox, we can just wait for the reports to arrive (in testing, this was fast — under one second).

Chrome DevTools Application Reporting API panel

Chrome DevTools -> Application -> Reporting API

Configuration Chrome (158.0.8127.88) Firefox (158.0.1)
Host: localhost, Reporting-Endpoints: localhost ❌ ✅
Host: ngrok, Reporting-Endpoints: ngrok ✅ ✅
Host: ngrok, Reporting-Endpoints: localhost ❌ ✅
Host: localhost, Reporting-Endpoints: ngrok ❌ ✅

What's the issue?

I believe the issue is related to Chromium issue 546285538. It appears Chrome only checks whether the scheme is cryptographic, rather than whether the origin is "potentially trustworthy". Because of this, we lose the localhost exception.

Technically that check is just for accepting Reporting-Endpoints, though I hope that as part of the fix, updating to the standard definition of "potentially trustworthy" will also cover the HTTP response that pins the header.

Mitigation

For local CSP development, either test in Firefox, serve your local environment over HTTPS (for example via ngrok), or stick to the deprecated report-uri directive.