Reroute traffic from CloudFront distribution to another domain URL

0

Hi,

I need to solve an interesting case related to CloudFront rerouting. Earlier I setup a S3 bucket which is used as a origin in CloudFront and I can fetch the data using this CloudFront Distribution url. Now I want to redirect all my request coming to xyz.cloudfront.net on port 5000 to be routed to abc.non-aws-domain.com. xyz.cloudfront.net:5000/rest-info/doc —> abc.non-aws-domain.com:443/rest-info/doc The problem is I see now that xyz.cloudfront.net:5000 does not exist. I tried to use ALB for this purpose but I see that after creating it and some rules I still see with curl that there is no rerouting. What did I miss? Should I use another solution for this?

Kind regards, Ivan Manzhulin

Ivan M
質問済み 3ヶ月前280ビュー
2回答
1

Hello.

As you know, CloudFront listens on ports 80 and 443, so accessing it on port 5000 will result in an error.
https://repost.aws/knowledge-center/cloudfront-supported-protocols

I think it is possible to route using ALB.
Have you configured the ALB redirect action?
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#redirect-actions

For example, if you configure the following settings, when an access occurs at "http://ALBDNS:5000", a redirect will occur to "google.com".
a

profile picture
エキスパート
回答済み 3ヶ月前
  • Thanks, I did almost the same. I used ALB (internet-facing); created target groups, listener on port 5000 and rule to redirect to URL. But I do not see that this is working

  • The reason why I want to use port 5000 is to set up CNAME on this CloudFront and redirect Docker incoming requests (docker pull mostly). And at the same time just CloudFront distribution URL should redirect to S3 bucket objects (this part was done and tested)

0

Thanks, it worked. I forgot to create a custom VPC with public subnets (I was using a default one before).

Ivan M
回答済み 3ヶ月前

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

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

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

関連するコンテンツ