Search code examples
amazon-web-serviceshttp-redirectaws-application-load-balancer

AWS ALB to redirect to an URL


I am trying to use AWS ALB to redirect all the traffic to http URL during any application upgrade.

I have created a default rule which listens to 80 and redirects to S3 URL (http://bucket-name.s3-website-ap-southeast-2.amazonaws.com:80/index.html). The S3 URL is accessible thru my browser. But when I access the URL that points to ALB the redirection to the S3 URL doesnt work.

Rule Details:

last - HTTP80: default action - IF Requests otherwise not routed - - THEN Redirect to http://bucket-name.s3-website-ap-southeast-2.amazonaws.com:80/index.html?#{query} Status code:HTTP_301

Can anybody help me with this


Solution

  • You do not need to mention index.html, just pass the default path where index.html is placed inside s3. enter image description here

    make sure you have set index file in your s3.

    If you just want some static response, You can also send HTML response, you do not need to configure s3.

    enter image description here Also, make sure there is proper CloudFront integrated with your static website in case of the redirect as I see you redirect to http. you can check further here