为了使用我的一个存储桶作为静态网站托管,我有以下 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>
然后我有以下编辑重定向规则:
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>abc</KeyPrefixEquals>
</Condition>
<Redirect>
<HostName>myec2instance.com</HostName>
</Redirect>
</RoutingRule>
我想做的是,当S3收到POST请求/abc时,将请求和请求体重定向到我的EC2实例。重定向规则有效(我可以通过将POST切换为GET请求来测试),但出于某种原因,当请求为POST时,S3返回HTTPResponse 405。有什么想法吗?