Re: CORS policy: No 'Access-Control-Allow-Origin'

CORS policy: No 'Access-Control-Allow-Origin'

Suport
Visitor
2 0 1

Access to fetch at 'https://*******.myshopify.com/admin/products/577154096292/metafields.json'
(redirected from 'https://domain.com/admin/products/577154096292/metafields.json')
from origin 'https://domain.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Replies 4 (4)

Jason
Shopify Partner
11206 226 2311

That error makes sense to me as you are trying to fetch across domains. It does raise alarm bells for me though as it looks like this call is being done in the browser. Is it? That won't be secure.

 

Can you share a little more about what you are trying to do and the tool being used to do the fetch?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Suport
Visitor
2 0 1

Hi Jason,
I am trying to get the product meta-fields value in liquid file using script with below format.

fetch(`/admin/products/577145380004/metafields.json`)

 

We have Primary Domain & Shopify Managed domain to the same store these are redirecting(pointing) from each other and returning CORS policy Error.

PatriciaHung
Shopify Partner
4 0 2

Hi jason, thank for your answer I have had the same problem, I am just trying to connect with a API of the Interfuerza CRM, I cheked it in postman and works very good, but when I do the fetch from my .js file, i have the same error, please if you have any idea 🙏🏻
"Access to fetch at 'https://app.interfuerza.com/api/v4/' from origin 'https://patri-test-store.myshopify.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."

PatriciaHung
Shopify Partner
4 0 2

Hi jason, thank for your answer I have had the same problem, I am just trying to connect with a API of the Interfuerza CRM, I cheked it in postman and works very good, but when I do the fetch from my .js file, i have the same error, please if you have any idea 🙏🏻
"Access to fetch at 'https://app.interfuerza.com/api/v4/' from origin 'https://patri-test-store.myshopify.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."