Home S3 - Redirect to a static website using a POST request
Reply: 1

S3 - Redirect to a static website using a POST request

4m1nh4j1
1#
4m1nh4j1 Published in 2018-02-12 20:29:27Z

I am hosting a static website on S3 and this is my form that redirects to this website. I don't need to get any of the submitted parameters, just a simple redirect.

        <form action="http://website.com" method="POST"  >
          // my code
        </form>  

After submitting the form, I am redirected to the static website but I had this error:

405 Method Not Allowed
Code: MethodNotAllowed
Message: The specified method is not allowed against this resource.
Method: POST
ResourceType: OBJECT
RequestId: 1EEFE221F692910D
HostId: obKOVc3LTyhc4NUdrs+S7DXOOv6FZYmdWEXOgCo3UVdb6beiI/aP8bQxihaMUenYTJyE+thrCaQ=

My S3 bucket CORS configuration is the following:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>HEAD</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedHeader>*</AllowedHeader>    
    <MaxAgeSeconds>3000</MaxAgeSeconds>
</CORSRule>
</CORSConfiguration>

While it seems that my CORS configuration are right, I don't still find from where comes the error message (405 Method Not Allowed).

Michael - sqlbot
2#
Michael - sqlbot Reply to 2018-02-13 02:00:09Z

If you need to use a form to "redirect," use <form ... method="GET">.

You can't submit a POST request to an S3 website hosting endpoint. It would serve no purpose, so it isn't allowed.

405 Method Not Allowed is always the response -- this can't be changed.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302701 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO