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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠