目前,我们已经为整个容器设置了 CORS:
azure storage cors set --blob static --cors '[{"AllowedOrigins":"*","AllowedMethods":"GET","MaxAgeInSeconds":"86400"}]'
是否有可能直接为该容器中的每个blob
设置规则?
例如- 对于 static/images/pic.png
设置 "AllowedOrigins":"*"
但对于 static/css/style.css
- 设置 “AllowedOrigins”:“google.com”
?
最佳答案
Is there any possibility to set rule directly and separately for each blob in that container?
不幸的是没有。我理解 CORS 的方式是它以某种方式实现了两个域之间的信任。对于 Azure 存储,域是按服务划分的(例如 youraccount.blob.core.windows.net
等)。因此,CORS 规则是在服务级别设置的。
关于Azure 存储 Blob : set CORS on the blobs level?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36543488/