Azure的引导字体 [英] Azure bootstrap fonts
问题描述
似乎无法来解决这个,IM的Pusing自定义引导CSS和放大器;字体到我蔚蓝的CDN但在铬我不断收到
字体从原产地 http://azxxxxxx.vo.msecnd.net '已经从加载阻止跨来源资源共享政策:没有访问控制允许来源标头的请求的资源present Origin的 HTTP://localhost.domain:16300因此'是不允许访问。
Can't seem to solve this, im pusing a custom bootstrap css&fonts into my azure cdn but in chrome I keep getting "Font from origin 'http://azxxxxxx.vo.msecnd.net' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost.domain:16300' is therefore not allowed access.
我修改了引导的CSS
I modified my bootstrap css
font-face {
font-family: 'Glyphicons Halflings';
src: url('//azxxxxxx.vo.msecnd.net/fonts/glyphicons-halflings-regular.eot');
src: url('//azxxxxxx.vo.msecnd.net/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('//azxxxxxx.vo.msecnd.net/fonts/glyphicons-halflings-regular.woff') format('woff'), url('//azxxxxxx.vo.msecnd.net/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('//azxxxxxx.vo.msecnd.net/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
我已经读了几帖计算器,增加了以下到我的webconfig
I've read a few stackoverflow posts, added the following to my webconfig
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/octet-stream" />
</staticContent>
仍然有同样的问题,任何想法?
Still have the same issue, any ideas?
推荐答案
假设你上传的字体/ CSS来Azure存储与Azure的CDN门前。
Assuming you've uploaded fonts/CSS to Azure Storage fronted with Azure CDN.
您需要启用对存储CORS,让您的网站访问字体跨域。
You need to enable CORS on the storage to allow your site to access fonts cross-domain.
完整的步骤将在<一个href=\"http://blogs.msdn.com/b/windowsazurestorage/archive/2014/02/03/windows-azure-storage-introducing-cors.aspx\"相对=nofollow>的Windows Azure存储:介绍CORS
从文章的部分样品(你需要得到的NuGet近期Azure的客户端库来构建它):
Partial sample from the article (you'll need to get NuGet for recent Azure client libraries to build it):
private static void InitializeCors()
{
// CORS should be enabled once at service startup
// Given a BlobClient, download the current Service Properties
ServiceProperties blobServiceProperties = BlobClient.GetServiceProperties();
ConfigureCors(blobServiceProperties);
BlobClient.SetServiceProperties(blobServiceProperties);
}
private static void ConfigureCors(ServiceProperties serviceProperties)
{
serviceProperties.Cors = new CorsProperties();
serviceProperties.Cors.CorsRules.Add(new CorsRule()
{
AllowedHeaders = new List<string>() { "*" },
AllowedMethods = CorsHttpMethods.Get | CorsHttpMethods.Head,
AllowedOrigins = new List<string>() { "*" },
ExposedHeaders = new List<string>() { "*" },
MaxAgeInSeconds = 1800 // 30 minutes
});
}
这篇关于Azure的引导字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!