No 'Access-Control-Allow-Origin' header is present on the requested resource

Hi there,

I am using axios as my HTTP client.

I made a get request in your …/analytics/dashboard endpoint, it was a success using Postman but I am getting this error message:

“…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.”

I am only running my web app. on my local.

Please help, I cant see any solutions yet. Thanks in advance!

The CORS policy for the API is set this way for security reasons, so there’s no way to directly call the CF API from a browser.

If you want to use the API, you’ll need some sort of backend API yourself that calls the CF API since these don’t need to respect CORS headers.

2 Likes

Ohhh, I guess I’ll just have to build a Back-end API for it. Thanks!