- Newest
- Most votes
- Most comments
Hi There,
I understand that you’re noticing a '405 Method not allowed' response after performing a POST request against your Cloudfront-distributed website with S3 Static Website as your origin. You're seeking confirmation on this behavior as you already implemented the POST, PUT, PATCH and DELETE options for your cache behavior.
You're correct to assume that the S3 Static Website only supports GET and HEAD requests; write operations are not supported through the S3 Static Website Endpoint [1].
This would explain why you're experiencing the '405 Method not allowed' requests when attempting to POST through your Cloudfront distribution. You will expect the same results if you are to attempt the POST against the S3 Static Website endpoint as well. If you want to perform POST requests against your S3 origin through your CloudFront distribution, you'll need to use the S3 REST endpoint, other than the S3 Website endpoint [2]. You can identify the S3 REST endpoint as bucket-name.s3.amazonaws.com , whereas the S3 Static Website endpoint includes s3-website-region.amazonaws.com . There are some key differences between the two endpoint types, one of them being that the S3 Website endpoint doesn't support SSL connections (see [3] for additional details).
Please let me know if you have any additional questions or concerns, I'll be happy to assist you. Till then, stay safe
========== Resources ==========
[1] Website endpoints - Key differences between a website endpoint and a REST API endpoint - https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteEndpoints.html#WebsiteRestEndpointDiff
[2] Using Amazon S3 Origins, MediaPackage Channels, and Custom Origins for Web Distributions - Using Amazon S3 Buckets for Your Origin - https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistS3AndCustomOrigins.html#concept_S3Origin
[3] Website endpoints - Key differences between a website endpoint and a REST API endpoint - https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteEndpoints.html#WebsiteRestEndpointDiff
Please note that I personally value your feedback, please accept this answer if you find it helpful to you.
Relevant content
- asked 8 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 years ago
Edit: thank you very much for your thorough answer. After reading your response and additional documentation, I implemented my hosted landing page a bit differently than as advised by the following document, which is what I originally used: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started-cloudfront-overview.html#getting-started-cloudformation-create-s3-www-bucket
One thing that I found very interesting is that it appears that Route 53 does not need a root domain record and knows how to redirect to the subdomain record; with and without the root domain record the solution works. I left it in place just to be thorough.
Thanks again for your response.
Hi There EG83, I am glad you have found the solution to the issue. If you have found my answer helpful in anyway, please accept and give it a thumbs up, I would appreciate that very much, thank you.
Done! Thanks again! :)
You are most welcome,
Please do mark the answer as accepted as that can be useful to the next people that search.
Interesting, I don't see/have an option to accept your answer. In fact, somehow, when I log in and go into My Dashboard, my own question does not appear under Questions, but I can see my subsequent comments (such as this one) under Comments. Probably a glitch as apparently my own question is not my question. Go figure!