S3 POST请求S3与响应405

编程入门 行业动态 更新时间:2024-10-14 18:17:58
本文介绍了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="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

本文发布于:2023-11-23 16:39:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622158.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:POST

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!