# HttpGatewayRoutePathMatch

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

- Source: [`aws-appmesh/lib/http-route-path-match.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-appmesh/lib/http-route-path-match.ts#L134)

## 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()
```

## Methods

- `bind(scope: Construct): HttpGatewayRoutePathMatchConfig` — Returns the gateway route path match configuration.

- `exactly(path: string, rewriteTo?: string): HttpGatewayRoutePathMatch // chainable` (static) — The value of the path must match the specified value exactly.

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

  **Parameters**

  - `path` — the exact path to match on.
  - `rewriteTo` — 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` (static) — The value of the path must match the specified regex.

  **Parameters**

  - `regex` — the regex used to match the path.
  - `rewriteTo` — 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` (static) — The value of the path must match the specified prefix.

  **Parameters**

  - `prefix` — the value to use to match the beginning of the path part of the URL of the request.
  - `rewriteTo` — Specify either disabling automatic rewrite or rewriting to specified prefix path.
