S3 - 访问控制允许原始标题 [英] S3 - Access-Control-Allow-Origin Header
问题描述
有人设法将 Access-Control-Allow-Origin
添加到响应标头中吗?
我需要的是这样的:
< img src =http://360assets.s3。 amazonaws.com/tours/8b16734d-336c-48c7-95c4-3a93fa023a57/1_AU_COM_180212_Areitbahn_Hahnkoplift_Bergstation.tiles/l2_f_0101.jpg/>
此get请求应包含在响应头, Access- Allow-Origin:*
我的桶的CORS设置如下所示:
<?xml version =1.0encoding =UTF-8?>
< CORSConfiguration xmlns =http://s3.amazonaws.com/doc/2006-03-01/>
< CORSRule>
< AllowedOrigin> *< / AllowedOrigin>
< AllowedMethod> GET< / AllowedMethod>
< MaxAgeSeconds> 3000< / MaxAgeSeconds>
< AllowedHeader> *< / AllowedHeader>
< / CORSRule>
< / CORSConfiguration>
正如你所期望的那样,没有 Origin
要编辑您的S3存储桶权限:
1)登录AWS管理控制台并通过
Did anyone manage to add Access-Control-Allow-Origin
to the response headers?
What I need is something like this:
<img src="http://360assets.s3.amazonaws.com/tours/8b16734d-336c-48c7-95c4-3a93fa023a57/1_AU_COM_180212_Areitbahn_Hahnkoplift_Bergstation.tiles/l2_f_0101.jpg" />
This get request should contain in the response, header, Access-Control-Allow-Origin: *
My CORS settings for the bucket looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
As you might expect there is no Origin
response header.
To edit your S3 bucket permissions:
1) Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/
2) In the Buckets list, open the bucket whose properties you want to view and click "add CORS configuration"
3) Write the rules you are willing to add in between the tags <CORSConfiguration>
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
</CORSRule>
</CORSConfiguration>
You can learn more about rules at: http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html
这篇关于S3 - 访问控制允许原始标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!