Skip to content

Commit f9a8002

Browse files
Merge pull request #6 from code-dot-org/redirect-http-to-https
redirect http to https
2 parents 316f5ad + 23ce57b commit f9a8002

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

cicd/3-app/aiproxy/template.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,30 @@ Resources:
7272
- !ImportValue VPC-PublicSubnetE
7373

7474
HttpListener:
75-
Type: AWS::ElasticLoadBalancingV2::Listener
76-
Properties:
77-
DefaultActions:
78-
- Type: forward
79-
TargetGroupArn: !Ref TargetGroup
80-
LoadBalancerArn: !Ref LoadBalancer
81-
Port: 80
82-
Protocol: HTTP
75+
Type: AWS::ElasticLoadBalancingV2::Listener
76+
Properties:
77+
Port: 80
78+
Protocol: HTTP
79+
DefaultActions:
80+
- Type: redirect
81+
RedirectConfig:
82+
Protocol: HTTPS
83+
Port: 443
84+
Host: "#{host}"
85+
Path: "/#{path}"
86+
Query: "#{query}"
87+
StatusCode: HTTP_301
88+
LoadBalancerArn: !Ref LoadBalancer
8389

8490
HttpsListener:
8591
Type: AWS::ElasticLoadBalancingV2::Listener
8692
Properties:
93+
Port: 443
94+
Protocol: HTTPS
8795
DefaultActions:
8896
- Type: forward
8997
TargetGroupArn: !Ref TargetGroup
9098
LoadBalancerArn: !Ref LoadBalancer
91-
Port: 443
92-
Protocol: HTTPS
9399
Certificates:
94100
- CertificateArn: !Ref HttpsCertificate
95101

0 commit comments

Comments
 (0)