Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
taylorjboone
New Member

CORS Errors on Embedded for Customers Power BI Report

I have been trying to embed a Power BI report into a flask website using the embed for customers tutorials. When I attempt to load the report on the website, requests named 'conceptualschema?userPreferredLocale=en-US' and 'modelsAndExploration?preferReadOnlySession=true' are being blocked by CORS errors. This is the request url in front of both requests: 'https://wabi-us-gov-virginia-redirect.analysis.usgovcloudapi.net/explore/reports/c5fe6639-c22d-4bd5-.... We have tried setting the header 'Access-Control-Allow-Origin' to a wildcard(*) on the initial request, but the header is only applied to the first request made. Has anyone run into this problem before?

2 REPLIES 2
Anonymous
Not applicable

Hi @taylorjboone,

Please review the following thread which has similar problem as yours, hope it can help you resolve the problem...

CORS issue with PowerBI API

CORS is a browser security feature that disallows cross site referencing. Hence there isn't any setting on the PowerBI part to get it fixed. We earlier worked with the REST APIs but faced CORS issue on almost every browser. Using the CORS plugin for Chrome fixed the issue. But can't expect every user to install the client side plugi...

As a work around, we took the WebAPI approach, wherein our client side script hit the WebAPI endpoint, communicated with the PowerBI service to return the report. To overcome the CORS issue this way, add a reference to System.Web.Cors in the WebConfig.cs file found under App_Start folder and add the line config.EnableCors();

In the Controller, decorate the method with EnableCors as shown below and that should resolve your problem:

namespace MyNameSpace.MyControllers
{
    public class MyAPIController : ApiController
    { 
       [HttpPOST]
       [EnableCors(origins: "*", headers: "*", methods: "*")]
       public string getData()
       {
          return "This Works !";
       }
    }
}

Best Regards

Would you happen to know how to do this in flask (python)? I haven't been able to find a file analogous to WebConfig.cs.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors