Skip to content

Commit 0514b9e

Browse files
redirect http to https
1 parent fb6fda6 commit 0514b9e

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

cicd/3-app/aiproxy/template.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,31 @@ Resources:
7171
- !ImportValue VPC-PublicSubnetD
7272
- !ImportValue VPC-PublicSubnetE
7373

74-
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
74+
HttpListner:
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)