不支持 Azure CDN 'Standard Microsoft' 层预检 'OPTIONS'

Azure CDN 'Standard Microsoft' tier preflight 'OPTIONS' not supported

我正在使用 Azure CDN (Ex: https://example-cdn.azureedge.com) to deliver static website from backend-endpoint which is Blob storage. Everything works fine except that Http request for static file(Ex: translation files stored on assets folder location /assets/i18n/en.json) from Angular application (Ex: https://example.com) are failed. As per the document,CORS 自动设置为 *

我观察到 Angular 应用程序在发出实际 GET 请求之前使用 HttpClient does a preflight 请求发出 http 请求。 Azure CDN 似乎不支持预检 OPTIONS 请求。浏览器请求失败并显示错误消息 Response for preflight does not have HTTP ok status.

这是在 Azure CDN 上设置的规则快照

问题是,如何使用 Angular 应用程序

从 Azure CDN 有条件地请求文件

如果有人遇到此问题,请确保您的原始主机正在响应这些请求。就我而言,Azure 存储帐户是原始主机。启用CORS settings on Storage account后CDN开始响应。