When I create an ALB listener, it appears I need to set a TargetGroupArn
.
But I was thing why not just return 404 ... I seem to be able to do this with ActionType
of fixed-response
. But even if I want to return a fixed-response, I need a target group? This does not seem to make sense?
Whats the best practice for default action?
Yes, you can use a listener with the following cloudformation snippet in conjunction with your ALB...
HttpListener:
Type: 'AWS::ElasticLoadBalancingV2::Listener'
Properties:
DefaultActions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: 404
LoadBalancerArn: !Ref LoadBalancer
Port: 80
Protocol: HTTP
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With