Redirect https to http

0

I have used CloudFront to associate my domain mistergnu.uk to the S3 endpoint https://s3.eu-west-2.amazonaws.com/mistergnu.uk/index.html. It will only work if I type http://mistergnu.uk - if I type mistergnu.uk it reverts to https://mistergnu.uk which will not load.

I have searched for answers to this but I can't find anything that works. I have also tried requesting a security certificate in case that has any bearing, but I can't verify the certificate - I've tried requesting this by email but I cannot enter my email address and I don't have an AWS one set up.

An answer here (https://repost.aws/questions/QUPxQQNielSAW5y-a9REm4XA/endpoint-does-not-work-because-of-https-redirect) directs me to use AWS Amplify, but my static website is not shown as an app. If I go to Host your web app it asks me to select GitHub, Bitbucket and so on - I'm not using any of these with my static webpage. I have a GitHub account but there are no repositories in it and I don't know what 'push a commit' means.

It all seems very complicated for what should be something simple. All I want is for my S3 endpoint (as above) to show up when I type mistergnu.uk in the address bar.

I have looked at all suggested answers when posting my question. Much mention is made of load balancers and more of AWS Amplify, but again this all seems horribly complicated and way beyond my technical experience. Surely there must be a way to do this simply?

Clearly my ignorance is vast. Can anyone help?

2回答
0

Can you access it via it's <ID>.cloudfront.net URL?

Can you create new CloudFront distribution with the following settings?

  • Origin domain: s3.eu-west-2.amazonaws.com
  • Protocol: HTTPS only
  • Origin path: /mistergnu.uk
  • Default root object: index.html

To associate it with your domain http://mistergnu.uk, you need to add Alternate domain name (CNAME) to your CloudFront distribution with value of mistergnu.uk.

This is in addition to create Route 53 alias record to CloudFront FQDN. Refer to Configuring Amazon Route 53 to route traffic to a CloudFront distribution.

Screenshot below for illustration. Go to CloudFront console to get actual <ID>.cloudfront.net value Enter image description here

For SSL/TLS cert, you can go to Certificate Manager in us-east-1 Region and request a public cert using DNS validation. It should be fairly seamless as your DNS hosting is on Route 53. You can enter mistergnu.uk and *.mistergnu.uk as the FQDN(Fully qualified domain name ) to request

AWS
エキスパート
Mike_L
回答済み 2ヶ月前
profile picture
エキスパート
Kallu
レビュー済み 2ヶ月前
  • Thank you for your help with this - I still can't get it to work!

    I have followed the steps you gave above but can still only get http://mistergnu.uk to load. If I type mistergnu.uk the browser tries to load https://mistergnu.uk which it still cannot do.

    I can manage with this the way it is, but I don't know what I am doing wrong!

    Thanks anyway

  • DNS for mistergnu.uk (52.95.148.192), resolves to a S3 bucket and not CloudFront distribution. You need to delete that DNS entry, and create mistergnu.uk DNS record that is a R53 alias record to your <ID>.cloudfront.net as per post above

0

Hello.

If you simply want to host a static website on S3, you should be able to solve it by just configuring CloudFront and S3.
The following documents should be helpful.
https://repost.aws/knowledge-center/cloudfront-serve-static-website
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html

Also, to issue an SSL certificate to CloudFront with ACM, you need to issue the certificate in the "us-east-1" region.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cnames-and-https-requirements.html

profile picture
エキスパート
回答済み 2ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ