Reporting API endpoint confusion
dougw
Posted on
May 05 2022
Your documentation on configuring the Reporting API HTTP header lists the general reporting endpoint as:
https://report-to-api.raygun.com/reports?apikey=<YOUR-API-KEY>
And your CSP reporting doc lists the CSP violation reporting endpoint as:
https://report-to-api.raygun.com/reports-csp?apikey=<YOUR-API-KEY>
Of course, it's no problem defining multiple endpoints for different uses, but what has confused me is that the Reporting API docs also give an example of using the general reporting endpoint for CSP violations.
Is it the case that we really only need to define the one endpoint and use it for all our reporting needs, including CSP?
dougw
Posted on
May 05 2022
And while I have your attention, it would be nice if you updated your docs to include the new Reporting-Endpoints
header and the benefits of defining a "default" endpoint.
Jason Fauchelle
Raygun
Posted on
May 26 2022
Thanks for providing this feedback and apologies for the confusion.
We'll be working on updating this documentation shortly to correct some details and clear up the confusion. Mentioning Reporting-Endpoints
and the default
endpoint name might need to be included in a follow up update of the docs.
In the meantime, I'll explain the difference in the endpoints here. The /reports-csp
endpoint was built for the original CSP specification that uses the report-uri
field to send a single CSP report. Starting from CSP3, a report-to
field was added that ties into the general reporting specification. This can be pointed to our /reports
endpoint which takes an array of reports. (Meaning yes, the /reports
endpoint does support CSP reporting, but only when using report-to
).
report-to
isn't supported by all browsers yet, so the recommendation seems to be to set both fields. report-uri
should point to the /reports-csp
endpoint and report-to
should point the the /reports
endpoint.
I hope that helps explain these endpoints better. Let me know if you have any further questions about this.
dougw
Posted on
May 26 2022
Thanks, that helps a lot!