Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions infrastructure/load-balancers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ Resources:
- Type: forward
TargetGroupArn: !Ref DefaultTargetGroup

# ALB global redirect from HTTP to HTTPS

PublicLoadBalancerHttpRedirectListener:
Type: AWS::ElasticLoadBalancingV2::Listener
DependsOn:
- LoadBalancer
Properties:
DefaultActions:
- RedirectConfig:
Host: "#{host}"
Path: "/#{path}"
Port: 443
Protocol: "HTTPS"
Query: "#{query}"
StatusCode: HTTP_301
Type: redirect
LoadBalancerArn: !Ref LoadBalancer # don't know how to construct this - see https://stackoverflow.com/questions/52085478/aws-cloudformation-application-load-balancer-how-to-redirect-http-listener-to/53498717#53498717
Port: 80
Protocol: HTTP

# We define a default target group here, as this is a mandatory Parameter
# when creating an Application Load Balancer Listener.
# However, this is not used - instead a target group is created per-service
Expand Down