The superagent documentation contains this entry about CORS:
For security reasons, browsers will block cross-origin requests unless the server opts-in using CORS headers. Browsers will also make extra OPTIONS requests to check what HTTP headers and methods are allowed by the server. Read more about CORS.
The .withCredentials() method enables the ability to send cookies from the origin, however only when Access-Control-Allow-Origin is not a wildcard ("*"), and Access-Control-Allow-Credentials is "true".
However, it does not explain which server needs to implement CORS.
There are two servers that (I think) it could refer to:
- The web server which sends the HTML and JavaScript to the browser
- The API / resource server that the delivered JavaScript makes a request to
Which server must implement CORS?