Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CloudFront distribution returns Error 400

I have a CloudFront distribution set up with some Origins and associated Behaviours. This is virtually a duplicate of another similar (working) distribution I have. I get the following error when attempting to access the service through the alternative domain name:

Bad request. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.

According to other posts on this and other forums this is likely due to one of the following two issues (see 403 ERROR The request could not be satisfied):

  1. The request is initiated over HTTP, but the CloudFront distribution is configured to only allow HTTPS requests.
  2. The requested alternate domain name (CNAME) isn't associated with the CloudFront distribution.

In case all CloudFront origins are configured for http and this is reflected in the actual call made to the service:

enter image description here

The CNAME has also been updated as can be seen here:

enter image description here

Testing the CNAME record with Route53 produces no error:

enter image description here

I am not sure where else to look for the issue. I cannot find any differences when comparing to the working distributions I already have running.

[Edit]

Actually it is only a 400 error. Not 403.

like image 625
Paul Avatar asked Sep 28 '26 12:09

Paul


1 Answers

if use Django, you can modify configuration ALLOWED_HOSTS, add the request address to ALLOWED_HOSTS of setting.py

like image 89
yutao song Avatar answered Sep 30 '26 04:09

yutao song



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!