Skip to content
v2.273.0

HttpGatewayRoutePathMatch Class ​

Defines HTTP gateway route matching based on the URL path of the request.

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'),
    },
  }),
});

Initializer ​

ts
new HttpGatewayRoutePathMatch()
python
HttpGatewayRoutePathMatch()
java
new HttpGatewayRoutePathMatch()
csharp
new HttpGatewayRoutePathMatch()
go
NewHttpGatewayRoutePathMatch()

Methods ​

bind(scope: Construct): HttpGatewayRoutePathMatchConfigdef bind(self, scope: Construct) -> HttpGatewayRoutePathMatchConfigpublic HttpGatewayRoutePathMatchConfig bind(Construct scope)public HttpGatewayRoutePathMatchConfig Bind(Construct scope)func Bind(Scope Construct) HttpGatewayRoutePathMatchConfig#
Returns the gateway route path match configuration.
exactly(path: string, rewriteTo?: string): HttpGatewayRoutePathMatch // chainable@staticmethod def exactly(path: str, rewrite_to: typing.Optional[str] = None) -> HttpGatewayRoutePathMatchpublic static HttpGatewayRoutePathMatch exactly(String path, String rewriteTo)public static HttpGatewayRoutePathMatch Exactly(string path, string? rewriteTo = null)func Exactly(Path *string, RewriteTo *string) HttpGatewayRoutePathMatchstatic#
The value of the path must match the specified value exactly.

The provided path must start with the '/' character.

2 parameters

Parameters

  • pathpathpathpathPath — the exact path to match on.
  • rewriteTorewrite_torewriteTorewriteToRewriteTo — the value to substitute for the matched part of the path of the gateway request URL As a default, retains original request's URL path.
regex(regex: string, rewriteTo?: string): HttpGatewayRoutePathMatch // chainable@staticmethod def regex(regex: str, rewrite_to: typing.Optional[str] = None) -> HttpGatewayRoutePathMatchpublic static HttpGatewayRoutePathMatch regex(String regex, String rewriteTo)public static HttpGatewayRoutePathMatch Regex(string regex, string? rewriteTo = null)func Regex(Regex *string, RewriteTo *string) HttpGatewayRoutePathMatchstatic#
The value of the path must match the specified regex.
2 parameters

Parameters

  • regexregexregexregexRegex — the regex used to match the path.
  • rewriteTorewrite_torewriteTorewriteToRewriteTo — the value to substitute for the matched part of the path of the gateway request URL As a default, retains original request's URL path.
startsWith(prefix: string, rewriteTo?: string): HttpGatewayRoutePathMatch // chainable@staticmethod def starts_with(prefix: str, rewrite_to: typing.Optional[str] = None) -> HttpGatewayRoutePathMatchpublic static HttpGatewayRoutePathMatch startsWith(String prefix, String rewriteTo)public static HttpGatewayRoutePathMatch StartsWith(string prefix, string? rewriteTo = null)func StartsWith(Prefix *string, RewriteTo *string) HttpGatewayRoutePathMatchstatic#
The value of the path must match the specified prefix.
2 parameters

Parameters

  • prefixprefixprefixprefixPrefix — the value to use to match the beginning of the path part of the URL of the request.
  • rewriteTorewrite_torewriteTorewriteToRewriteTo — Specify either disabling automatic rewrite or rewriting to specified prefix path.