Re建议允许开发者配置OSS文件的跨域Http头,避免Ajax请求遇到跨域CORS错误
我看API文档中已经支持了CORS的相关操作了,第125页。
-------------------------
回11楼wood23的帖子
5.6.1 Put Bucket cors
Put Bucket cors 操作将在指定的 bucket 上设定一个跨域资源共享(CORS)的
规则,如果原规则存在则覆盖原规则。
请求语法:
PUT /?cors HTTP/1.1
Date: GMT Date
Content-Length:ContentLength
Content-Type: application/xml
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Authorization: SignatureValue
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>the origin you want allow CORS request from</AllowedOrigin>
<AllowedOrigin>…</AllowedOrigin>
<AllowedMethod>HTTP method</AllowedMethod>
<AllowedMethod>…</AllowedMethod>
<AllowedHeader> headers that allowed browser to send</AllowedHeader>
<AllowedHeader>…</AllowedHeader>
<ExposeHeader> headers in response that can access from client app</ExposeHeader>
<ExposeHeader>…</ExposeHeader>
<MaxAgeSeconds>time to cache pre-fight response</MaxAgeSeconds>
</CORSRule>
<CORSRule>
….
</CORSRule>
….
</CORSConfiguration >