Cross-Origin Resource Sharing (CORS)

You want richer error data? - Enable CORS!

Coview platform has built-in functionality for monitoring and tracking down errors originating in your customer's browser. Usually, browsers happily report any errors - except when the offending code is served from a CDNCDN - Short for Content Delivery Network, CDN is a group of servers spread out over many locations. These servers store duplicate copies of data so that servers can fulfill data requests faster based on which servers are closest to the respective end-users. or a different domain. In that case, all that you get is a meaningless Script error on line 0 message instead of a stack trace and a description.

To unlock error reporting for cross-origin scripts, you will need to enable CORSCORS - Short for Cross-Origin Resource Sharing, CORS is a security mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. support. This will let you bypass the same-origin policy in a secure way and allow Coview to capture error data coming from other third-party scripts as well.

Enabling CORS on your website is straightforward and involves two steps described below.

1. Send the CORS header for your script files

Attach the following HTTP header to the response containing your script files:

Access-Control-Allow-Origin: *

2. Modify your script tags

Script tags have an attribute called crossorigin which allows to pass error data to a window.onerror callback. Define it on applicable script tags with a value set to anonymous:

<script
  src="https://example.com/example-framework.js"
  crossorigin="anonymous"
 ></script>

Learn more


Did this page help you?