Hey, I'm currently converting a chrome extension to Safari. From the background script I make a number of API calls to the server.
I'm hitting an issue where some requests are failing with the following: Failed to load resource: Origin safari-web-extension://<id> is not allowed by Access-Control-Allow-Origin. Status code: 200.
The reason I say some is that it's appears to be happening at random. I tested with a call being made every minute. Sometimes all requests fail with the above, sometimes 1 will pass and the rest fail. It doesn't seem to be consistent across GET, POST or PUT requests either.
The CORS configuration on the server simply reflects the caller's origin for a CORS request so I can support calls from the extension. An example GET call from the extension is below, I send the token but also add withCredentials to support other browsers.
fetch('/url', {
headers: {
'Authorization: Bearer <token>'
},
withCredentials: true
}
Has anyone else hit similar issues? This all works perfectly in Chrome/Edge, Safari seems to be the anomaly here.