Hello,
I've built a static site with redirect in S3. The GET method works and bring the data from target URL. But the POST method does not work and returns the below error. I've also enabled CORS for the bucket (please see below the configuration). Even if CORS is enabled in the 405 response I got headers: Access-Control-Allow-Methods(PUT, POST) together with Allow(GET, HEAD, OPTIONS). The target URL has also CORS enabled.
Could you please specify how to enable POST in this redirect ?
<html>
<head>
<title>405 Method Not Allowed</title>
</head>
<body>
<h1>405 Method Not Allowed</h1>
<ul>
<li>Code: MethodNotAllowed</li>
<li>Message: The specified method is not allowed against this resource.</li>
<li>Method: POST</li>
<li>ResourceType: OBJECT</li>
<li>RequestId: 6CKWBHWQ1NDT23BK</li>
<li>HostId: WOWpQ7TUER6ZrN5TFCd4+eWMLir8bh5cZqXFERixkACtN611XW+IqILMvt45VAb5AQRAo/AlwfM=</li>
</ul>
<hr />
</body>
</html>
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"PUT",
"POST"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]
Thank you for your answer,
To clarify, I try to send some data from localhost Postman to S3 using POST method.
I've read the link you provided, and notice two types of endpoints to S3: S3 REST endpoint (bucket-name.s3.amazonaws.com), and S3 Static Website endpoint (s3-website-region.amazonaws.com). The REST endpoint is the same as the one where the REST commands are sent to S3 (https://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html), or is another one ?
Thank you,
Mihai ADAM
For REAT API "bucket-name.s3.amazonaws.com" should be used.