带有响应405的S3 POST请求到S3

use*_*167 6 http-post amazon-s3 amazon-ec2 amazon-web-services http-status-code-405

我有S3的以下CORS配置,以便使用我的一个桶作为静态网站托管:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
    </CORSRule>
</CORSConfiguration>
Run Code Online (Sandbox Code Playgroud)

然后我有以下编辑重定向规则:

<RoutingRules>
    <RoutingRule>
    <Condition>
        <KeyPrefixEquals>abc</KeyPrefixEquals>
    </Condition>
    <Redirect>
        <HostName>myec2instance.com</HostName>
    </Redirect>
</RoutingRule>
Run Code Online (Sandbox Code Playgroud)

我想要做的是当S3收到POST/abc将请求和请求主体重定向到我的ec2实例时.重定向规则工作正常(我能够通过将POST切换到GET请求来测试它)但是由于任何原因,S3在请求是POST时返回HTTPResponse 405.有什么想法吗?

Mic*_*bot 12

这不是CORS相关的 - 它本身就是S3.S3网站端点仅配备GETHEAD.在检查重定向规则之前,应该拒绝任何其他内容.

网站端点

仅支持对象的GET和HEAD请求.

- http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html