Reputation: 133
farwardtotargetgroup:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
Certificates:
- CertificateArn: !Ref cert
DefaultActions:
- TargetGroupArn: !Ref target-group
Type: forward
LoadBalancerArn: !Ref nlb
Port: 443
Protocol: TLS
redirectto443:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- RedirectConfig:
Port: 443
StatusCode: HTTP_301
Type: redirect
LoadBalancerArn: !Ref nlb
Port: 80
Protocol: TLS
When I execute template I got:
The action type 'redirect' is not valid with network load balancer (Service: AmazonElasticLoadBalancingV2; Status Code: 400; Error Code: InvalidLoadBalancerAction;
Upvotes: 6
Views: 4976
Reputation: 35258
Redirect rules are only supported for Application Load Balancers, not a network load balancer.
If you can use an application load balancer for your application then you will be able to make use of it.
From documentation
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Upvotes: 7