Alaeddine Douagi
Alaeddine Douagi

Reputation: 1145

AWS Route 53 integration with Cloudfront error (403)

I deployed a react app to AWS recently after following this tutorial, everything is working fine except when I wanted to integrate a custom domain that I bought recently using AWS Route 53, I get an error (403).

For the integration of Route 53 with CloudFront I followed these steps in the docs as they are, I know that my problem is related to some sort of permission authority, but I don't know where exactly I did something wrong.

Page error 403

Upvotes: 27

Views: 12826

Answers (3)

Alaeddine Douagi
Alaeddine Douagi

Reputation: 1145

Solved, my problem was related to unassigned Alternate Domain Names (CNAMEs) for the CloudFront Distribution.

Upvotes: 40

Rotem jackoby
Rotem jackoby

Reputation: 22058

Adding additional information regarding the two answers above.

As described in How do I resolve the error "The request could not be satisfied. Bad Request" from Amazon CloudFront :

This error message "The request could not be satisfied. Bad Request." is from the client and the error can occur due to one of the following reasons:

1) The request is initiated over HTTP, but the CloudFront distribution is configured to allow only HTTPS requests.

2) The requested alternate domain name (CNAME) isn't associated with the CloudFront distribution.

Solution for #1:
Open the Amazon CloudFront console -> Select the relevant distribution -> Go Behaviors view -> Choose the behavior that matches the request and Edit -> Then select in the Viewer Protocol Policy between the options of: HTTP and HTTPS or Redirect HTTP to HTTPS.

Solution for #2:
Since this release when you add an alternate domain name to a distribution, you must also attach a SSL/TLS certificate to that distribution that covers the alternate domain name.

So, first of all make sure that you do the following before you update your distribution to add an alternate domain name:

A) Register the domain name with domain provider (GoDadday, CloudFlare, Route 53 etc').

B) Add a certificate from an authorized certificate authority (for example - Let's Encrypt) to CloudFront that covers the domain name you plan to use with the distribution, to validate that you are authorized to use the domain. (Read more in here).

And only then:
Open Amazon CloudFront console -> General view -> Edit -> Alternate Domain Names (CNAMEs) -> enter the CNAME that you want to associate with the CloudFront distribution (for example www or home).

Upvotes: 10

Kannaiyan
Kannaiyan

Reputation: 13025

Looks like you are trying http instead of https.

If you have enabled http, then it means the destination method or path cannot be reached.

Upvotes: 1

Related Questions