Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I send a post request to Cloudfront?

I can't send a post request to Cloudfront that I set up for my Ec2s. I get the 404 and 400 error. How do I request requests to my EC2 machines via cloudfront?

like image 965
AHC Avatar asked Mar 24 '26 13:03

AHC


1 Answers

This is because by default the Allowed HTTP Methods for a CloudFront distribution are GET, HEAD.

From the console perform the following:

  • Click on your distribution
  • Click on the Behaviours tab.
  • Select your behaviour and click Edit
  • Under the Allowed HTTP Methods select GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE
  • Click Yes, Edit

This process might take upt an hour to rollout to all Edge locations, but normally is much quicker.

Below is a screenshot of the option from the interface.

enter image description here

like image 52
Chris Williams Avatar answered Mar 27 '26 07:03

Chris Williams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!