我才能使用我的水桶一个作为一个静态的网站托管S3以下CORS的配置:
I have the following CORS configuration for S3 in order to use one of my buckets as a static website hosting:
<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="s3.amazonaws/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>POST</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> </CORSRule> </CORSConfiguration>
然后,我有以下编辑重定向规则:
Then I have the following Edit Redirection Rules:
<RoutingRules> <RoutingRule> <Condition> <KeyPrefixEquals>abc</KeyPrefixEquals> </Condition> <Redirect> <HostName>myec2instance</HostName> </Redirect> </RoutingRule>
在S3收到一个POST / ABC重定向请求,并请求体到我的EC2实例我想要做的就是。重定向规则是否工作正常(我是能够通过切换张贴到GET请求来测试这一点),但由于某种原因S3将返回HTT presponse 405当请求是一个POST。任何想法,为什么?
What I want to do is when S3 receives a POST to /abc redirects the request and request body to my ec2 instance. The redirection rule is working properly (I was able to test this by switching POST to a GET request) but for any reason S3 is returning HTTPResponse 405 when the request is a POST. Any ideas why?
推荐答案这是没有关系的CORS - 这是S3本身。在S3网站终端只配备 GET 和 HEAD 。重定向规则核对之后还有什么应该被拒绝。
This isn't CORS related -- it's S3 itself. The S3 website endpoints are only equipped for GET and HEAD. Anything else should be denied before the redirection rules are checked.
网站端点
仅支持GET和对象HEAD请求。
Supports only GET and HEAD requests on objects.
&mdash; docs.aws.amazon/AmazonS3/latest/dev /WebsiteEndpoints.html
更多推荐
S3 POST请求S3与响应405
发布评论