hosting fonts on azure cdn - CORS support

拥有回忆 提交于 2019-12-18 04:48:15

问题


I cannot get azure blob storage hosted fonts exposed via azure cdn working in IE or Firefox.

I believe this is because of @font-face cross-domain issues (CORS) and the normal solution is to add an Access-Control-Allow-Origin header. I know that most CDNs now support this but am assuming that Azure still doesn't. Can anyone confirm this?

If this is the case, are there any workarounds?


回答1:


This is no longer true, azure supports CORS

http://blogs.msdn.com/b/windowsazurestorage/archive/2013/11/27/windows-azure-storage-release-introducing-cors-json-minute-metrics-and-more.aspx

and a little guide to adding fonts to your azure cdn:

http://www.devtrends.co.uk/blog/hosting-web-fonts-in-azure-blob-storage-using-the-new-cors-support




回答2:


The CDN doesn't modify the headers from the origin, so it responds with whatever headers blob storage emits. Blob storage does not support CORS headers.

I'm surprised to learn that @font-face has cross-domain restrictions, but it appears that you're right (for Firefox and IE).

If you have that option, you could put the fonts on a cloud service (rather than blob storage) behind the CDN and emit the right headers there.




回答3:


Your assessment is correct.

As a workaround, our company is utilizing Google storage (which supports CORS).

I would also suggest voting up this issue so the Azure team knows how many people are running into it.

http://www.mygreatwindowsazureidea.com/forums/34192-windows-azure-feature-voting/suggestions/2850796-support-cross-origin-resource-sharing-cors-via-a




回答4:


I can use fonts, without setting up the CORS option anyway. I'm linking my fonts directly to the blob storage, and not a CDN, since this one does not supports the CORS from the blob.



来源:https://stackoverflow.com/questions/12901792/hosting-fonts-on-azure-cdn-cors-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!