Next.js Discord

Discord Forum

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

Unanswered
Longtail tuna posted this in #help-forum
Open in Discord
Avatar
Longtail tunaOP
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at

So, i had no problems fetching from server side but on client CORS are not being allowed, i tried setting headers on next.config.mjs like on next documentation (https://nextjs.org/docs/pages/api-reference/config/next-config-js/headers#options) but didn't succeed

this is trying to fetch documents from sanity.
Image

3 Replies

Avatar
Brown bear
That sounds like your have CORS issues from sanity and not nextjs. Might need more context, but this may help https://www.sanity.io/docs/cors
Avatar
Longtail tunaOP
yep, i specified CORS for https instead of http on sanity project
silly me