All checks
Medium ELB · regional

Application Load Balancer should be configured to redirect all HTTP requests to HTTPS

Ensures every HTTP listener on an Application Load Balancer redirects requests to HTTPS, so no client is served over an unencrypted connection. One HTTP listener without the redirect fails the load balancer. Only each listener's default action is read, so a redirect set on a path-matched rule does not clear this.

service
ELB
severity
Medium
scope
evaluated in every region

How to fix it

  • Can break clients: The listener stops forwarding and answers every request with a redirect, so an HTTPS listener must already serve port 443 or those clients reach nothing.
  • Affects another check: The redirecting HTTP listener still fails ELB.18, which wants no HTTP listener; deleting it instead, if no client needs the redirect, passes both.

In the console

EC2 → Load balancers → the load balancer → Listeners and rules → the HTTP listener → Rules → Default → Actions → Edit rule

Default action
Redirect to URL
URI parts → Protocol
HTTPS
URI parts → Port
443
Status code
Permanent (HTTP 301)

With the AWS CLI

aws elbv2 modify-listener --listener-arn <listener-arn> --default-actions Type=redirect,RedirectConfig='{Protocol=HTTPS,Port=443,StatusCode=HTTP_301}' --region <region>

With Terraform

resource "aws_lb_listener" "http_redirect" {
  load_balancer_arn = var.load_balancer_arn
  port              = 80
  protocol          = "HTTP"

  default_action {
    type = "redirect"

    redirect {
      port        = "443"
      protocol    = "HTTPS"
      status_code = "HTTP_301"
    }
  }
}

See which of your accounts this check is failing on.

Book a live scan