简体   繁体   中英

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.

页面错误 403

已解决,我的问题与CloudFront分配的未分配备用域名 (CNAME)有关。

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 ).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM