Search code examples
amazon-web-servicesamazon-route53aws-application-load-balancer

AWS ALB Http to Https redirection - How to convert redirected insecure connection to a secure connection?


ALB is attached with 2 listeners, https and http being redirected to https(port 443) with same host, path, query as per below. And a route 53 alias record forwards the sales.company.com to this ALB.

LBListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
        -
          Type: 'redirect'
          RedirectConfig:
            Protocol: 'HTTPS'
            Port: 443
            Host: '#{host}'
            Path: '/#{path}'
            Query: '#{query}'
            StatusCode: 'HTTP_301'
      LoadBalancerArn: 'LBArn'
      Port: 80
      Protocol: 'HTTP'

Https listener is attached with a ssl certificate created for sales.company.com.

When I access https://sales.company.com through browser then I see the connection is secure and everything works fine. But when I access it with http://sales.company.com then connection is not secure, why ? And how can this be made secure ?

UPDATED - Added screen shot of ALB Added screen shot

enter image description here


Solution

  • I have re-created my whole infrastructure stack and it resolved the problem for me without any change in the configurations mentioned in the question so i am marking it resolved.