Each unique origin you want to get reports for can be given a series of "endpoints", which are named URLs (or groups of URLs) that can be sent reports from a user agent.
A reporting server at these endpoints can collect the reports, and process and present them as needed by your application.
The Reporting-Endpoints
HTTP header is used to specify details about the different endpoints that a user-agent has available to it for delivering reports.
The report-to
directive can then be used on particular HTTP response headers to indicate the specific endpoint that will be used for the associated report.
For example, the CSP Content-Security-Policy-Report-Only
HTTP headers to specify the endpoint that CSP violation reports should be sent to.
Note:
There is no absolute guarantee of report delivery — a report could still fail to be collected if a serious error occurs.
The reports themselves are sent to the target endpoint by the user agent in a POST
operation with a Content-Type
of application/reports+json
.
They are serializations of Report
objects, where the type
indicates the type of report, the url
indicates the origin of the report, and the body
contains a serialization of the API interface that corresponds to the report type.
For example, CSP violation reports have a type
of csp-violation
and a body
that is a serialization of a CSPViolationReportBody
object.
Reports sent to endpoints can be retrieved independently of the running of the websites they relate to, which is useful — a crash for example could bring down a website and stop anything running, but a report could still be obtained to give the developer some clues as to why it happened.