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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
NaveenB
New Member

Custom visuals are not rendering due to a CORS error while making an API call

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.

1 REPLY 1
Adamboer
Responsive Resident
Responsive Resident

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.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.