locked
Enabling CORS to serve Web Fonts via a CDN / Azure Blob Storage RRS feed

  • Question

  • Hi,

    I'm really struggling to enable CORS to enable a website to serve a custom font using @fontface via an Azure CDN with font files stored in Azure Blob Storage.

    The CDN is active and fonts can be accessed via the browser, however when I reference the fonts via a secure site to load the custom font the following error is seen on the console:

    "*** has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource"

    I have previously created a custom app to enable CORS, rule snippet below:

    var cors = new CorsRule();
    cors.AllowedOrigins.Add("*");
    cors.AllowedHeaders.Add("*");
    cors.AllowedMethods = CorsHttpMethods.Get;
    cors.MaxAgeInSeconds = 3600;

    I can the rule has been successfully created via the Azure Storage Explorer Tool.

    Am I missing something?

    Thanks in advance

    Wednesday, April 20, 2016 2:41 PM

All replies

  • If you created the CORS rule after you started using Azure CDN the CORS updates wouldn't get picked up until TTL for caching content on the CDN expires - by default the TTL is 7 days. To resolve this you can use UI from the Azure portal or APIs to purge your content. If you still see issues please provide a sample URL and also http response headers that are returned when you make a request to the CDN.
    Wednesday, April 20, 2016 9:20 PM