简体   繁体   English

Azure CDN 字体加载问题

[英]Azure CDN font loading issue

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). 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.除 fonts 外,所有 static 资产(如 JS、CSS、图像)均从 CDN 加载。 It says CORS orgin error for CDN endpoint.它说 CDN 端点的 CORS 组织错误。 I have also tried adding mime type in web.config file of he Azure Web App but no luck.我还尝试在 Azure Web 应用程序的 web.config 文件中添加 mime 类型,但没有运气。
Can anyone help to resolve this issue.任何人都可以帮助解决这个问题。

Screenshot:截屏:

Azure CDN .woff 字体错误

Answering this as it might help others with similar queries:回答这个问题,因为它可能会帮助其他有类似查询的人:

CORS support is built-in for Azure App Service. CORS 支持内置于 Azure 应用服务。 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. 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:要通过 Azure CLI 启用 CORS,请使用az webapp cors命令,如下所示:

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

Refer to this blog post for a detailed walkthrough.有关详细演练,请参阅博客文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM