-1

New at this, so forgive me if the answer is obvious.

I created a CDN for use with a standard javascript library (a commercial graphing library).

The library has many files, and is present in 4 directories (modules, fonts, styles etc)

I stored all the above in a storage account, and then created anf linked a CDN account to it. The access is anonymous, as it will be accessed by IOT devices that need the javascript libraries fr operation (and the devices have insufficient memory to serve the files themselves).

All seemed to work, except I am getting CORS policy errors, when the library tries to access a font in the same CDN, but in a different directory.

Here is the error in the web browser

192.168.0.202/:1 
   Access to font at 'https://xxx.azureedge.net/htmlelements/styles/font/smart-icons.woff2' from origin 'http://192.168.0.202' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.enter code here

Is there a way to globally cross allow access of files in the same cdn, but in different directories? (I looked at the online help, and got nowhere.

Thanks

Kartik Bhiwapurkar
  • 4,550
  • 2
  • 4
  • 9

1 Answers1

-1

I added this line in my part of the html page

<meta http-equiv="Access-Control-Allow-Origin" content="*"/>

I also added

DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", "*");

before my first server.on() routine in the asyncwebserver responses area on the server

The errors seem to have gone away.

Not sure if that is what is required, but willing to take suggestions if there is anything incomplete or wrong.

Thanks