1
votes

I created an alb named demoLoadBalancer with two target groups, namely tg1 and tg2. Both the target groups had ec2 instances running. ec2 instance in tg1 was running an apache server with LandingPage.html in /var/www/html and tg2 had music.html in /var/www/html. I have configured path rules in load balancer. Default path is set to LandingPage.html, /server1/* is set to LandingPage.html and /server2/* is set to music.html. The screenshot is attached below:

enter image description here

enter image description here

Now, when i access the default url of the demoloadbalancer, it forwards me to LandingPage.html. But when i try to load the webPage using /server/LandingPage.html it throws 404 error.The images are attached below:

enter image description here

enter image description here

enter image description here

Thanks in advance!!!

1
When you copy the DNS name of the ALB and enter in the browser with /server1/LandingPage.html in the URL, are you getting error 404? - Asri Badlah
It gives the following error when i try and access /server1/LandingPage.html : "Not Found The requested URL was not found on this server. Apache/2.4.29 (Ubuntu) Server at demoloadbalancer-756339062.us-east-2.elb.amazonaws.com Port 80" - Ashutosh

1 Answers

0
votes

The rules wyou have configured for the Path based routing are an Exact Match.

To forward trrafice to /server1/something and /server2/something.

you have to configure a rule for the path with the wildcard like this /server1* and /server2* , This will ensure that the any other information under this path is served for the users properly.