Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

TextureLoader Error: "Access to Image at 'https://mydomain.com>' Has Been Blocked by CORS Policy"

3 replies
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.
Jul 30, 2021, 4:15 PM
The problem is now showing again.
Aug 11, 2021, 7:46 AM
It's very random, somethimes works somethimes not
Aug 11, 2021, 7:46 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?