我尝试按照here设置CORS,但有错误:
$ azure storage cors set --blob static --cors [{\"AllowedOrigins\":\"*\",\"AllowedMethods\":\"GET\"}]
info: Executing command storage cors set
+ Setting storage CORS rules for service: blob
error: Unexpected token :
[{\"AllowedOrigins\":\"*\",\"AllowedMethods\":\"GET\"}]
有什么问题?
答案 0 :(得分:3)
我相信你错过了MaxAgeInSeconds
参数。如果我尝试没有这个参数,我会收到一个错误。但以下情况对我有用:
azure storage cors set --blob static
--cors "[{\"AllowedOrigins\":\"*\",\"AllowedMethods\":\"GET\",\"MaxAgeInSeconds\":\"86400\",\"AllowedHeaders\":\"*\",\"ExposedHeaders\":\"*\"}]"
-a "account-name" -k "account-key" --verbose