Why we want to do this - Means redirection of HTTP to https or non-www version to https://www version.

It's really helpful for SEO and the search engine has only one copy of your website. Otherwise, what happen Google/other search engine bots treat your website as a different website.
So I am assuming that you have already had an AWS account and you have a running instance in it and your website already configured on Route 53 if not then you do it by yourself if you have any questions then you can write in the comment box.
Steps for Redirection of an HTTP request to HTTPS in Application Load Balancer at AWS
- Create an SSL certificate or use your own certificate in Certificate manager/IAM (it is required for application load balancer)
- Create an application load balancer
- Configure security group (skips if its already open)
- Configure port 80 to redirection to 443
- Set new DNS to your Route 53
- First log in to AWS Account and Go to EC2 Instance and > Load Balancer
- Click on Create Load Balancer
Step 3: Now we have to choose - Application Load Balancer and click on Create
Step 4 Enter the information as per below image
You can choose Name - like i chosen - dvo-application-load-balncr
You have to allow both the port 80 and 443
then choose the availability zone
Once you done then click on Next Configure security group in bottom
Step 5: Here you can choose your certificate or you can create or you can also import external certificates which you may buy from other companies/websites.
Step 6 : Configure Security group (Here i have already created by security group and i allowed few ports as per my application requirements.). Then click on next
Step 7: Basically we have our EC2 instance and our Tomcat is running on port 80 so we have kept as it.
Now click on Register targets
Step 8: Register Targets (means we have to attach our running ec2 instance to this application load balancer and i attached it)
Step 9 Is review of your configuration
Step 10: If its success like this then your application load balancer is ready.
Now you can click on close button.
Now you can see our application load balancer is active. (Actually, I kept a screenshot of another tab like a listener)
But here in Listeners you can see we have port 80 and 443 for https but in 443 we have SSL Certificate but in port 80 http we don't have and its default action is forwarding so instead of forwarding we have to make a change like a redirect. So click on View/edit rules in Rules column for HTTP 80.
It will show like this so we have to edit these rules here
The first click on Edit pencil icon on top then it will show one more pencil icon near this IF row click on it.
Now we have to delete this Then click in last one.

Once you change it will be look like this.
Now we have to just need to update the DNS of this load balancer in Route 53 in a A record set.
and we hare done.
Comments
Post a Comment