Complete the code to specify the protocol for the listener.
listener = elbv2.Listener(self, "Listener", load_balancer=alb, port=80, protocol=[1], default_target_groups=[target_group])
The listener protocol must be set to HTTP for port 80 to handle web traffic.
Complete the code to add a listener rule that forwards requests with path '/images/*' to the image target group.
listener.add_action("ImageRule", priority=10, conditions=[elbv2.ListenerCondition.path_patterns([[1]])], action=elbv2.ListenerAction.forward([image_target_group]))
The path pattern must match /images/* to route image requests correctly.
Fix the error in the listener rule condition to correctly match host header 'example.com'.
listener.add_action("HostRule", priority=5, conditions=[elbv2.ListenerCondition.host_headers([[1]])], action=elbv2.ListenerAction.forward([host_target_group]))
The host header must be a string with quotes, like "example.com", to be valid.
Fill both blanks to create a listener rule that forwards requests with method POST and path '/submit' to the submit target group.
listener.add_action("SubmitRule", priority=15, conditions=[elbv2.ListenerCondition.http_request_methods([[1]]), elbv2.ListenerCondition.path_patterns([[2]])], action=elbv2.ListenerAction.forward([submit_target_group]))
The HTTP method must be "POST" and the path pattern "/submit" to route form submissions correctly.
Fill all three blanks to define a listener rule that forwards requests with host 'api.example.com', path '/v1/*', and method GET to the api target group.
listener.add_action("ApiRule", priority=20, conditions=[elbv2.ListenerCondition.host_headers([[1]]), elbv2.ListenerCondition.path_patterns([[2]]), elbv2.ListenerCondition.http_request_methods([[3]])], action=elbv2.ListenerAction.forward([api_target_group]))
The host header must be "api.example.com", the path pattern "/v1/*", and the HTTP method "GET" to route API requests correctly.