简体   繁体   English

Azure存储Blob:在Blob级别设置CORS?

[英]Azure Storage Blob: set CORS on the blobs level?

Currently, we have set CORS for the whole container with: 目前,我们为整个容器设置了CORS,具体如下:

azure storage cors set --blob static --cors '[{"AllowedOrigins":"*","AllowedMethods":"GET","MaxAgeInSeconds":"86400"}]'

Is there any possibility to set rule directly and separately for each blob in that container? 是否有可能直接针对该容器中的每个blob单独设置规则?

Eg - for static/images/pic.png set "AllowedOrigins":"*" but for static/css/style.css - set "AllowedOrigins":"google.com" ? 例如-为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? 是否有可能直接针对该容器中的每个Blob单独设置规则?

Unfortunately no. 抱歉不行。 The way I understand CORS is that it somehow enables trust between 2 domains. 我了解CORS的方式是,它以某种方式在2个域之间实现了信任。 With Azure Storage, the domains are by service (eg youraccount.blob.core.windows.net etc.). 使用Azure存储,可以通过服务来访问域(例如youraccount.blob.core.windows.net等)。 Thus the CORS rules are set at the service level. 因此,CORS规则是在服务级别设置的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM