HttpGatewayRouteMatch

class aws_cdk.aws_appmesh.HttpGatewayRouteMatch(*, headers=None, hostname=None, method=None, path=None, port=None, query_parameters=None, rewrite_request_hostname=None)

Bases: object

The criterion for determining a request match for this GatewayRoute.

Parameters:
  • headers (Optional[Sequence[HeaderMatch]]) – Specifies the client request headers to match on. All specified headers must match for the gateway route to match. Default: - do not match on headers

  • hostname (Optional[GatewayRouteHostnameMatch]) – The gateway route host name to be matched on. Default: - do not match on host name

  • method (Optional[HttpRouteMethod]) – The method to match on. Default: - do not match on method

  • path (Optional[HttpGatewayRoutePathMatch]) – Specify how to match requests based on the ‘path’ part of their URL. Default: - matches requests with any path

  • port (Union[int, float, None]) – The port number to match on. Default: - no default port

  • query_parameters (Optional[Sequence[QueryParameterMatch]]) – The query parameters to match on. All specified query parameters must match for the route to match. Default: - do not match on query parameters

  • rewrite_request_hostname (Optional[bool]) – When true, rewrites the original request received at the Virtual Gateway to the destination Virtual Service name. When false, retains the original hostname from the request. Default: true

ExampleMetadata:

infused

Example:

# gateway: appmesh.VirtualGateway
# virtual_service: appmesh.VirtualService


gateway.add_gateway_route("gateway-route-http-2",
    route_spec=appmesh.GatewayRouteSpec.http(
        route_target=virtual_service,
        match=appmesh.HttpGatewayRouteMatch(
            # This rewrites the path from '/test' to '/rewrittenPath'.
            path=appmesh.HttpGatewayRoutePathMatch.exactly("/test", "/rewrittenPath")
        )
    )
)

Attributes

headers

Specifies the client request headers to match on.

All specified headers must match for the gateway route to match.

Default:
  • do not match on headers

hostname

The gateway route host name to be matched on.

Default:
  • do not match on host name

method

The method to match on.

Default:
  • do not match on method

path

Specify how to match requests based on the ‘path’ part of their URL.

Default:
  • matches requests with any path

port

The port number to match on.

Default:
  • no default port

query_parameters

The query parameters to match on.

All specified query parameters must match for the route to match.

Default:
  • do not match on query parameters

rewrite_request_hostname

When true, rewrites the original request received at the Virtual Gateway to the destination Virtual Service name.

When false, retains the original hostname from the request.

Default:

true