37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/condo/strata/microsoft_azure.rb', line 37
def enable_cors(origin = 'http://localhost:9000')
origins = origin.class == Array ? origin : [origin]
blobs = azure_connection
p = blobs.get_service_properties
p.cors = Azure::Service::Cors.new do |cors|
cors.cors_rules = []
cors.cors_rules.push(Azure::Service::CorsRule.new { |cors_rule|
cors_rule.allowed_origins = origins
cors_rule.allowed_methods = ["GET", "HEAD", "PUT", "POST", "OPTIONS"]
cors_rule.max_age_in_seconds = 60
cors_rule. = ["x-ms-*", "etag", "content-type", "content-md5"]
cors_rule. = ["x-ms-blob-type", "x-ms-version", "content-md5", "content-type"]
})
end
blobs.set_service_properties(p)
end
|