Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysterious CloudFront "Bad request"

Tags:

I've set up a new domain and web server, and a CloudFront distribution to serve it.

CloudFront is successfully serving the site on its own domain: d1lnegrqin0up5.cloudfront.net

I want mpe.io (without www) to go to the web server, and www.mpe.io to go to the CloudFront distribution. As such, I set up a CNAME record for www.mpe.io pointing to the aforementioned CloudFront domain.

I gave it a couple of hours, and www.mpe.io goes to CloudFront (it says "Generated by cloudfront" on the resulting pages) but all requests simple result in a Bad request ERROR.

Note that if I go directly to the CloudFront domain, everything works fine. How can I get www.mpe.io successfully serving files in the same way the CloudFront domain is?

Specifics:

Domain DNS records:

  • Name, TTL, Type, Record
  • mpe.io., 3600, A, 101.0.76.155
  • www.mpe.io., 3600, CNAME, d1lnegrqin0up5.cloudfront.net
  • *.mpe.io., 3600, A, 101.0.76.155

Distribution settings:

  • Delivery method: Web
  • Cookie Logging: Off
  • Distribution Status: Deployed
  • Price Class: Use All Edge Locations (Best Performance)
  • State: Enabled
  • Alternate Domain Names (CNAMEs): - (could this be important?)
  • SSL Certificate: Default CloudFront Certificate (*.cloudfront.net)
  • Domain Name: d1lnegrqin0up5.cloudfront.net
  • Custom SSL Client Support: -
  • Default Root Object: /index
like image 450
Bilal Akil Avatar asked Aug 09 '15 09:08

Bilal Akil


People also ask

How do I resolve the error the request could not be satisfied request blocked from CloudFront?

To resolve the Request Blocked error when the default action is Allow, review the requests to be sure that they don't match the conditions for any AWS WAF rules with Action set to Block. If valid requests match the conditions for a rule that blocks requests, then update the rule to allow the requests.

Can CloudFront fail?

CloudFront fails over to the secondary origin only when the HTTP method of the viewer request is GET , HEAD , or OPTIONS . CloudFront does not fail over when the viewer sends a different HTTP method (for example POST , PUT , and so on).

Is CloudFront distribution ID unique?

CloudFront domain names are unique. Your distribution's domain name was never used for a previous distribution and will never be reused for another distribution in the future.


2 Answers

All good! I answered my question as I was writing it.

It was that field regarding Alternate Domain Names (CNAMEs) in the distribution's settings. When I added www.mpe.io as one of them and gave it some time, it ended up working fine.

like image 77
Bilal Akil Avatar answered Oct 12 '22 16:10

Bilal Akil


You made my day. The moment I added www.domain in the CloudFront Distributions, iI recognizes the web.

I also tried with one subdomain to test and added CloudFront URL in CNAME in GoDaddy and subdomain entered in CloudFront Distributions and it also works.

I added the snapshot of CloudFront for amateurs like me.

enter image description here

like image 45
Saurabh Sinha Avatar answered Oct 12 '22 15:10

Saurabh Sinha