CORS is still getting error

Continuing the discussion from CORS error when using Direct Creator Upload:

1 Like

@zaid @yevgen I saw previous posts concerning this problem, you wrote that you’ve fixed the issue but I’m still experiencing it. Maybe I’m doing something wrong. Please let me know ASAP. Trying to upload image from http://localhost using JS axios according with documentation:

const apiUrl = `https://api.cloudflare.com/client/v4/accounts/${process.env.cdnAccountId}/images/v1/direct_upload`
const formData = new FormData()
          formData.append('file', file)
          axios
            .post(apiUrl, formData, {
              headers: {
                'Content-Type': 'multipart/form-data',
                Authorization: `Bearer ${process.env.cdnToken}`,
              },
            })

but browser gives me an error:

Access to XMLHttpRequest at ‘https://api.cloudflare.com/client/v4/accounts/6fc232b74b51f1028fef57c23bf4e87f/images/v1/direct_upload’ from origin ‘http://localhost:3000’ 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.