Mysterious CloudFront "Bad request"

Bilal Akil picture Bilal Akil · Aug 9, 2015 · Viewed 15.6k times · Source

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

Answer

Bilal Akil picture Bilal Akil · Aug 9, 2015

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.