HTTPS redirects for apex domain

0

My customer needs a HTTP 301 redirect solution. They have their xyz.com mapped to certain A record along with www.xyz.com mapped to A record. They want scalable cloud native way to handle redirects from https://xyz.com to https://www.xyz.com. HTTPS redirects is a need and they want something integrates with ACM as well.

Some of the things that come to mind are:

  1. Create a Lambda function that returns an HTTP 301 response to the request. (Edit - Looks like you can directly use rule based on host header condition in ALB and set redirect action with custom 301 response)

  2. Front End the Lambda with ALB: Configure Lambda Function as target for ALB

3A.1 Use Global Accelerator with static IP address to FrontEnd ALB

3A.2 Use the GA static IP address as A record value for your domain that needs redirect.

3B.1 Use NLB with with static IP address to FrontEnd ALB.

3B.2 Use the NLB static IP address as A record value for your domain that needs redirect.

Any other suggestions? Or comments on above. Looks like CNAME won’t work as we have apex domain involved. Their DNS is not hosted on AWS.

Looking for suggestions on using API Gateway or Cloudfront Lambda @ Edge if possible. My doubt is only because of A record need as DNS is not in Route53.

1 Answer
0
Accepted Answer

I think that Global Accelerator with ALB endpoint and a Lambda function as target is a good starting point, because it's easy to deploy, maintain et to scale. Make sure you return Cache-Control header in Lambda function to leverage browser caching. You can think of other alternatives (NLB..) if the scaling mechanisms of ALB doesn't meet the needs of your customer.

Ideally, you move them to Route53 and leverage CloudFront + Lambda@Edge to do the redirection on the same user connection and optimize perfromance.

profile pictureAWS
EXPERT
achraf
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions