TextureLoader Error: "Access to Image at 'https://mydomain.com>' Has Been Blocked by CORS Policy"
Last updated: Aug 11, 2021
Does anyone encountered problem when fetching images via JS such like TextureLoader from threejs? I constantly get errors of cors also if my domain is enabled. The strange thing is that the error said that the origin is the localhost domain:
Access to image at '<https://cdn.sanity.io/images/*****/development/1e97591658bd9baa39647acbccd6a098c2e30c38-1400x1400.jpg?auto=format>' from origin '<https://mydomain.com>' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value '<http://localhost:3000>' that is not equal to the supplied origin.
Jul 30, 2021, 10:30 AM
it's strange because it's pretty usual that you have more than one cors domain and it will resolve always as a random one (it switch frequently from localhost to production) making a cache bursting param works.