Mike Olsen

  • ask me anything
  • rss
  • archive
  • Azure CDN now Supports CORS

    So we can finally host fonts in our Azure CDN!!!

    This goes for anything else subject to cross-origin resource sharing restrictions.

    So update your azure storage client library to (> 3.0) and do something like this:

    var client = storageAccount.CreateCloudBlobClient();
    var properties = client.GetServiceProperties();
    
    var cors = new CorsRule();
    cors.AllowedOrigins.Add("artfulhacker.com");
    cors.AllowedMethods = CorsHttpMethods.Get;
    cors.MaxAgeInSeconds = 3600;
    properties.Cors.CorsRules.Add(cors);            
    
    client.SetServiceProperties(properties);
    

    If you want to allow any parent calling domain use this instead:

    cors.AllowedOrigins.Add("*");
    

    More information on this can be found here:

    http://msdn.microsoft.com/en-us/library/windowsazure/dn535601.aspx

    • November 29, 2013 (5:57 pm)
    • #c
    • #cors
    • #fonts
    • #cdn
    • #azure
© 2013–2021 Mike Olsen