<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: CORS Errors on Embedded for Customers Power BI Report in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/CORS-Errors-on-Embedded-for-Customers-Power-BI-Report/m-p/2720211#M38111</link>
    <description>&lt;P&gt;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.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Aug 2022 12:24:57 GMT</pubDate>
    <dc:creator>taylorjboone</dc:creator>
    <dc:date>2022-08-23T12:24:57Z</dc:date>
    <item>
      <title>CORS Errors on Embedded for Customers Power BI Report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/CORS-Errors-on-Embedded-for-Customers-Power-BI-Report/m-p/2707046#M37949</link>
      <description>&lt;P&gt;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: '&lt;A href="https://wabi-us-gov-virginia-redirect.analysis.usgovcloudapi.net/explore/reports/c5fe6639-c22d-4bd5-90bf-de33ee26bd48/'" target="_blank" rel="noopener"&gt;https://wabi-us-gov-virginia-redirect.analysis.usgovcloudapi.net/explore/reports/c5fe6639-c22d-4bd5-90bf-de33ee26bd48/'&lt;/A&gt;. 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?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 14:28:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/CORS-Errors-on-Embedded-for-Customers-Power-BI-Report/m-p/2707046#M37949</guid>
      <dc:creator>taylorjboone</dc:creator>
      <dc:date>2022-08-17T14:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: CORS Errors on Embedded for Customers Power BI Report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/CORS-Errors-on-Embedded-for-Customers-Power-BI-Report/m-p/2715945#M38054</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/428028"&gt;@taylorjboone&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Please review the following thread which has similar problem as yours, hope it can help you resolve the problem...&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/49518890/cors-issue-with-powerbi-api" target="_self"&gt;CORS issue with PowerBI API&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class=""&gt;
&lt;DIV class="" data-post-id="49684986"&gt;&lt;SPAN&gt;&lt;SPAN&gt;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&lt;SPAN&gt;&amp;nbsp;&lt;A style="font-family: inherit; background-color: #ffffff;" href="https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en" target="_blank" rel="nofollow noopener noreferrer"&gt;CORS plugin&lt;SPAN&gt;&amp;nbsp;&lt;SPAN&gt;for Chrome fixed the issue. But can't expect every user to install the client side plugin.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;P&gt;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&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;System.Web.Cors&lt;SPAN&gt;&amp;nbsp;in the&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;WebConfig.cs&lt;SPAN&gt;&amp;nbsp;file found under&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;App_Start&lt;SPAN&gt;&amp;nbsp;folder and add the line&lt;SPAN&gt;&amp;nbsp;&lt;CODE&gt;config.EnableCors();&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;In the Controller, decorate the method with EnableCors as shown below and that should resolve your problem:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;namespace MyNameSpace.MyControllers
{
    public class MyAPIController : ApiController
    { 
       [HttpPOST]
       [EnableCors(origins: "*", headers: "*", methods: "*")]
       public string getData()
       {
          return "This Works !";
       }
    }
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 07:28:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/CORS-Errors-on-Embedded-for-Customers-Power-BI-Report/m-p/2715945#M38054</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-22T07:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: CORS Errors on Embedded for Customers Power BI Report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/CORS-Errors-on-Embedded-for-Customers-Power-BI-Report/m-p/2720211#M38111</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 12:24:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/CORS-Errors-on-Embedded-for-Customers-Power-BI-Report/m-p/2720211#M38111</guid>
      <dc:creator>taylorjboone</dc:creator>
      <dc:date>2022-08-23T12:24:57Z</dc:date>
    </item>
  </channel>
</rss>

