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
preguntada hace 3 meses280 visualizaciones
2 Respuestas
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
EXPERTO
respondido hace 3 meses
  • 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
respondido hace 3 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas