Skip to content
v2.278.0

HttpGatewayRouteMatch Struct ​

The criterion for determining a request match for this GatewayRoute.

Example ​

ts
declare const gateway: appmesh.VirtualGateway;
declare const virtualService: appmesh.VirtualService;

gateway.addGatewayRoute('gateway-route-http-2', {
  routeSpec: appmesh.GatewayRouteSpec.http({
    routeTarget: virtualService,
    match: {
      // This rewrites the path from '/test' to '/rewrittenPath'.
      path: appmesh.HttpGatewayRoutePathMatch.exactly('/test', '/rewrittenPath'),
    },
  }),
});
python
# 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")
        )
    )
)
java
VirtualGateway gateway;
VirtualService virtualService;


gateway.addGatewayRoute("gateway-route-http-2", GatewayRouteBaseProps.builder()
        .routeSpec(GatewayRouteSpec.http(HttpGatewayRouteSpecOptions.builder()
                .routeTarget(virtualService)
                .match(HttpGatewayRouteMatch.builder()
                        // This rewrites the path from '/test' to '/rewrittenPath'.
                        .path(HttpGatewayRoutePathMatch.exactly("/test", "/rewrittenPath"))
                        .build())
                .build()))
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
VirtualGateway gateway;
VirtualService virtualService;


gateway.AddGatewayRoute("gateway-route-http-2", new GatewayRouteBaseProps {
    RouteSpec = GatewayRouteSpec.Http(new HttpGatewayRouteSpecOptions {
        RouteTarget = virtualService,
        Match = new HttpGatewayRouteMatch {
            // This rewrites the path from '/test' to '/rewrittenPath'.
            Path = HttpGatewayRoutePathMatch.Exactly("/test", "/rewrittenPath")
        }
    })
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var gateway VirtualGateway
var virtualService VirtualService


gateway.addGatewayRoute(jsii.String("gateway-route-http-2"), &GatewayRouteBaseProps{
	RouteSpec: appmesh.GatewayRouteSpec_Http(&HttpGatewayRouteSpecOptions{
		RouteTarget: virtualService,
		Match: &HttpGatewayRouteMatch{
			// This rewrites the path from '/test' to '/rewrittenPath'.
			Path: appmesh.HttpGatewayRoutePathMatch_Exactly(jsii.String("/test"), jsii.String("/rewrittenPath")),
		},
	}),
})

Properties ​

headersoptionalHeaderMatch[]headersoptionaltyping.List[HeaderMatch]headersoptionalList<HeaderMatch>HeadersoptionalHeaderMatch[]Headersoptional*[]HeaderMatch #
Specifies the client request headers to match on.

Default: do not match on headers

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

hostnameoptionalGatewayRouteHostnameMatchhostnameoptionalGatewayRouteHostnameMatchhostnameoptionalGatewayRouteHostnameMatchHostnameoptionalGatewayRouteHostnameMatchHostnameoptionalGatewayRouteHostnameMatch #
The gateway route host name to be matched on.

Default: do not match on host name

methodoptionalHttpRouteMethodmethodoptionalHttpRouteMethodmethodoptionalHttpRouteMethodMethodoptionalHttpRouteMethodMethodoptionalHttpRouteMethod #
The method to match on.

Default: do not match on method

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

Default: matches requests with any path

portoptionalnumberportoptionalint | floatportoptionalNumberPortoptionaldoublePortoptional*float64 #
The port number to match on.

Default: no default port

queryParametersoptionalQueryParameterMatch[]query_parametersoptionaltyping.List[QueryParameterMatch]queryParametersoptionalList<QueryParameterMatch>QueryParametersoptionalQueryParameterMatch[]QueryParametersoptional*[]QueryParameterMatch #
The query parameters to match on.

Default: do not match on query parameters

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

rewriteRequestHostnameoptionalbooleanrewrite_request_hostnameoptionalboolrewriteRequestHostnameoptionalBooleanRewriteRequestHostnameoptionalboolRewriteRequestHostnameoptional*bool = true #
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.