FixedResponseOptions

class aws_cdk.aws_elasticloadbalancingv2.FixedResponseOptions(*, content_type=None, message_body=None)

Bases: object

Options for ListenerAction.fixedResponse().

Parameters:
  • content_type (Optional[str]) – Content Type of the response. Valid Values: text/plain | text/css | text/html | application/javascript | application/json Default: - Automatically determined

  • message_body (Optional[str]) – The response body. Default: - No body

ExampleMetadata:

infused

Example:

import aws_cdk.aws_certificatemanager as acm

# certificate: acm.Certificate
# lb: elbv2.ApplicationLoadBalancer
# bucket: s3.Bucket


trust_store = elbv2.TrustStore(self, "Store",
    bucket=bucket,
    key="rootCA_cert.pem"
)

lb.add_listener("Listener",
    port=443,
    protocol=elbv2.ApplicationProtocol.HTTPS,
    certificates=[certificate],
    # mTLS settings
    mutual_authentication=elbv2.MutualAuthentication(
        ignore_client_certificate_expiry=False,
        mutual_authentication_mode=elbv2.MutualAuthenticationMode.VERIFY,
        trust_store=trust_store
    ),
    default_action=elbv2.ListenerAction.fixed_response(200, content_type="text/plain", message_body="Success mTLS")
)

Attributes

content_type

Content Type of the response.

Valid Values: text/plain | text/css | text/html | application/javascript | application/json

Default:
  • Automatically determined

message_body

The response body.

Default:
  • No body