CORS error with Cloudflare in front of AWS API Gateway

I’ve created a Cloudflare proxy to point to the APIs deployed on AWS API Gateway.

I’ve followed all steps - generated certificate in Cloudflare, imported cert in AWS, created custom domain names, mapped APIs, created CNAME records, etc.
Connect Cloudflare to AWS API Gateway | Medium | Medium

Configuration is like:

  1. Cloudflare DNS name is
  2. AWS API custom domain name url is like
  3. AWS API invoke url in the deployed stage is

In the Rules in Cloudflare, I added the rule - to use strict SSL as recommended on one of the threads. (I’ve other APIs also on AWS API Gateway, like, etc.)

When I’m testing the API using either Cloudflare DNS name or AWS API custom domain name url, I’m getting CORS error, like:

Access to XMLHttpRequest at ‘’ from origin ‘’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.
The API call doesn’t even show up in the Cloudwatch logs.

When i’m testing with AWS API invoke url in the deployed stage, I’m able to get a response, and everything works fine.

Any help in resolving the CORS error is highly appreciated. Also, if any other information is required then please let me know.

Thanks in advance!


Thank you for asking and for a brief feedback information about the sitiation and the error you are encountering.


May I just ask is the hostname (DNS record) proxied and set to :orange: , correct?

It sounds to me like the AWS Bucket / AWS API Gateway is missing HTTP Headers like Access-Control-Allow-Origin and/or related to it (per need)?

May I suggest to take a look at the articles from below:

Thanks for your response.
I’ve tried all these three options.

Also, I’ve set DNS record to proxy only.


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