Safeguard
Developer Tools•

How do you set up CSP report-to with Reporting-Endpoints?

Name an endpoint in Reporting-Endpoints, point report-to at it, and read the JSON reports. Setup steps, report fields and the report-uri fallback.

Safeguard Security Team
3 min read

Define an endpoint name and URL in a Reporting-Endpoints response header, then add report-to with that name to your Content-Security-Policy. Browsers send violation reports as JSON to that URL. MDN says report-to is meant to replace report-uri, and you can send both while support spreads.

Definitions

CSP violation report: a JSON object the browser sends when a page breaks your policy, with a type of csp-violation.

Reporting-Endpoints: a response header that maps endpoint names to URLs.

report-to: a CSP directive that names which endpoint receives violation reports.

Setup steps

  1. Create a URL on a server you control that accepts POST requests with a content type of application/reports+json.
  2. Send the mapping header, for example Reporting-Endpoints: csp-endpoint="https://example.com/csp-reports".
  3. Add the directive to your policy, for example Content-Security-Policy-Report-Only: default-src 'self'; report-to csp-endpoint.
  4. Reload a page that loads an outside script and confirm a report arrives.
  5. Add report-uri too if you still need older browser coverage. MDN notes that browsers supporting report-to ignore report-uri.

MDN notes the directive is not supported in a meta element, so it must be sent as a header. MDN also marks the directive as newly available across the latest browsers since March 2026, and warns it might not work in older ones.

What a report contains

MDN's example shows fields in the report body, including these:

FieldMeaning
blockedURLWhat was blocked, or inline
effectiveDirectiveThe directive that applied, such as script-src-elem
dispositionWhether the policy was enforced or report only
documentURLThe page where it happened
sampleA snippet of the blocked code, when provided
originalPolicyThe policy text in force
sourceFile, lineNumberWhere the code came from

Turning reports into tag decisions

For marketing and web teams, the reports are a free inventory. Each unique blockedURL host is a candidate third party. Group them by host and by documentURL, then ask whether each one has an owner and a purpose. The script inventory method shows how to combine this with the network panel.

Handling the noise

Reports can be noisy. Browser extensions and injected code on visitors' machines can trigger violations that have nothing to do with your site. Triage by volume and by page. A host seen on many pages from many visitors is yours. A single report from one visitor is probably an extension. Keep report-only mode on for a few weeks before enforcing, as in the report-only rollout.

Treat the endpoint as a service

Reports can include page URLs, which might contain personal data. Keep the endpoint private to your team, set a short retention period, and do not forward raw reports to a third party without checking what they contain.

Quick check

Can I set report-to in a meta tag?

No. MDN says the directive is not supported in the meta element. Use a response header.

Do I still need report-uri?

Only for older browsers. Browsers that support report-to ignore it.

Where Safeguard fits

Safeguard's policies and gates can hold changes to header configuration behind review, and dependency scanning covers shipped packages. Try the free scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.