Cloudflare API :Get deployments api got CORS error

Cloudflare API Documentation — I can successfully test this api using postman, but when put into the project and used fetch or axios requests, a CORS error is returned.

Please tell me how to do it or need to configure CORS header information

Most endpoints on the Cloudflare API are not meant to be called by browsers, which it sounds like you’re doing, including this one. You won’t be able to configure the CORS Headers the Cloudflare API itself returns. You would be exposing your API Credentials as well. Have your backend or a Cloudflare Worker do the request for you, and return the information your frontend needs.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.