'How to redirect https to https with www using AWS application load balancer?

Can anyone please help me to figure out redirection issue with AWS application load balancer?

I have -

  • Deployed React JS app on EC2 - Ubuntu 18.04 with Nginx
  • Obtained SSL from AWS ACM
  • Attached ALB to EC2 instance, added 2 listeners - PORT 80, PORT 443 (Forwarding request to target group on PORT 80)
  • added CNAME record www pointing to ALB

Also, I have added redirect rule in listener 443 as -

enter image description here

But when I am visiting my site like - https://exampledomain.ai it throws DNS_PROBE_FINISHED_NXDOMAIN

Update: When I visit -

mydomain.ai //redirected to https://www.mydomain.ai
http://mydomain.ai //redirected to https://www.mydomain.ai
http://www.mydomain.ai //redirected to https://www.mydomain.ai

Is there anything else I am missing? Please help



Solution 1:[1]

  1. Create redirection rule on port 80 enter image description here

2. Go to route 53 and create a new cname with example.com and point to the same ALB.

Now it will work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 megasubhash