Per-file CORS in Azure CDN Premium from Verizon RRS feed

  • Question

  • We would like to distribute files via CDN but limit which web sites can refer them files. Our current best bet is on CORS even it depends on browser support (we are quite ok with this limitation).

    Each file might have a different set of CORS domain. There might be really lots of files on the CDN (no estimation available yet but I expect between 10 000 and 1 000 000 at start).

    It is possible to achieve that using Azure CDN? How?
    [my best bet is on using rules engine]

    • Edited by MCCZ Thursday, February 1, 2018 9:36 AM
    Wednesday, January 31, 2018 9:42 PM

All replies

  • Hi, please use the rules engine as you mentioned to add CORS headers, since it seems you cannot use just * wildcard for your scenario. 

    Follow the steps here. 


    Thursday, February 1, 2018 5:52 PM
  • Hi, thanks for your reply and confirmation.

    I am aware of the page you provided. However, I have not found answers to:

    1) Does the rule engine supports the base requirements (each file can have a different CORS).

    2) Can I change the rules engine programatically? If so, how? What are the limitations? I have found no PowerShell cmdlets and/or .NET classes related to rule engines.

    3) What are the limits of rule engines? It is possible to have thousands of them, a million? Will it work fast enough?


    Thursday, February 1, 2018 6:35 PM
  • 1. Yes you can have a different rule for each file.

    2. There is no programmatic access today.

    3. Since they are created by hand, it wouldn't be practical to create a million rules. However you can use wildcards and regex to match and create rules that work for multiple files. For example under path = "/fonts/*", add the header allow access-control-allow-origin: *.mysite.com, *.othersite.com, etc.

    Thursday, February 1, 2018 6:43 PM
  • Thanks. Unfortunately, a programmatic access is a must for our use case as the files and CORS settings are based on what our users specify for each of the file we would host for them.

    Or CORS set by the file origin are propagated through CDN automatically?

    • Edited by MCCZ Thursday, February 1, 2018 7:53 PM
    Thursday, February 1, 2018 7:26 PM