Azure CDN font loading issue

287 Views Asked by At

I have deployed the Blazor Web Assembly (ASP.Net Core Hosted) to Azure Web App then i have enabled the CDN (Standard Akamai pricing tier) for that Web App (Networking > Azure CDN). All the static asssets like JS, CSS, Images are loading from the CDN except fonts. It says CORS orgin error for CDN endpoint. I have also tried adding mime type in web.config file of he Azure Web App but no luck.
Can anyone help to resolve this issue.

Screenshot:

Azure CDN .woff Font error

1

There are 1 best solutions below

0
On

Answering this as it might help others with similar queries:

CORS support is built-in for Azure App Service. You can configure CORS via the Azure portal by navigating to your App Service, selecting CORS under the API section on the left blade, and specifying the origins that should be allowed to make cross-origin calls. To allow all, use "*" and remove all other origins from the list.

To enable CORS via Azure CLI, use the az webapp cors command as follows:

az webapp cors add --resource-group <resource-group-name> --name <app-name> --allowed-origins "['*']"

Refer to this blog post for a detailed walkthrough.