S3 POST请求S3与响应405 [英] S3 POST request to S3 with response 405

查看:519
本文介绍了S3 POST请求S3与响应405的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我才能使用我的水桶一个作为一个静态的网站托管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="http://s3.amazonaws.com/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.com</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; http://docs.aws.amazon.com/AmazonS3/latest/dev /WebsiteEndpoints.html

这篇关于S3 POST请求S3与响应405的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆