Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
We are getting a CORS (cross-origin resource sharing) error while calling an API from a Power BI custom visual. We are getting this error from only one domain, both in the Power BI Service and on the Desktop.
(Error: Access to XMLHttpRequest at 'xxxxxx' from origin 'null' 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).
We checked this custom visual in other domains of the Power BI service, API calls were successful, and the visual is rendering as expected.
We checked that ‘Access-Control-Allow-Origin’ as ‘*’ is enabled in the API call header and in the Backend as well.
Please let us know if we need to change any settings in Power BI to overcome this issue or if there is any other approach for resolving the issue.
The CORS error occurs when a web application makes a request to a resource on a different domain or port. In this case, the API endpoint you are trying to access is not allowing access from the domain you are using in the Power BI visual.
To resolve this issue, you need to configure the API to allow access from the domain or origin where your Power BI visual is hosted. You can do this by adding the domain or origin to the 'Access-Control-Allow-Origin' header in the API response.
Additionally, you can try to add the following header in the API response to allow credentials (if needed):
'Access-Control-Allow-Credentials': 'true'
If the issue still persists, you can try enabling the 'Allow any embedding' option in the Power BI report settings. This will allow the visual to load from any domain without any restrictions.
To enable this option, go to the report settings in the Power BI Service and under the 'Security' tab, toggle the 'Allow any embedding' option to 'On'.
Please note that enabling this option can pose security risks, so use it carefully and only if necessary.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
5 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
10 | |
4 | |
3 | |
2 | |
2 |