Blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present

My web app held in Cloudflare server keeps having the error whenever I utilise a particular API.
Access to XMLHttpRequest at ://example.co/CreateBooking from origin ‘://example.co’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
The startup.cs is set up with the following:
services.AddCors(options =>
{
options.AddDefaultPolicy(builder =>
{
builder.WithOrigins(Configuration.GetSection(“Application:AppDomain”).Value)
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
Appsetting setup:
“Application”: {
“AppDomain”: “://example.co”,
“AccessBeAppDomain”: “://api.example.co/api”,
This error only appears in Cloudflare environment, when in Production or localhost environment, it works fine. I look forward to your reply.

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