I am using a Load Balancer with Elastic Beanstalk. I want to redirect any host that is different than domain.com to domain.com.
Is that possible to achieve with an AWS load balancer?
I am using a Load Balancer with Elastic Beanstalk. I want to redirect any host that is different than domain.com to domain.com.
Is that possible to achieve with an AWS load balancer?
This is actually quite easy and fully supported by the AWS ALB.
What you're looking to do is to add a Host header based rule. The steps below should be followed:
View/Edit Rules+ symbol at the top of the console to add your rule, specify that the rule is a host header rule with a target of your target group.By adding the host header rule with a target as the target group for you app, it will only connect to your hosts for the correct host name.
Otherwise have the default action be a redirect action to redirect to the domain you specify.