How to make cross-origin (CORS) requests to an OVH Object Storage / Bucket
As of late, I encountered a problem where Google Chrome wouldn’t load images from the OVH Bucket I had just bought into.
It took me some time to find that my request failed because I was making two requests for the same object, one from HTML, one from XHR. The second one fails, because Chrome uses the cached response from the first request, which has no Access-Control-Allow-Origin response header.
You can use revving to make Chrome download the image every time:
let rand = '?'+Math.random(); let no_cors = new Image(); no_cors.src = 'https://s3.amazonaws.com/ch-static-beta/avatar/user/1a8fdd22d5ec11e784da0e28350150f71512059569.png' + rand;
This bug has been marked as a ‘wont-fixed’ one by the Chrome team.
Apparently, this is also a known issue by developers using S3 from Amazon.