# HttpGatewayRouteSpecOptions

Properties specific for HTTP Based GatewayRoutes.

Extends: [CommonGatewayRouteSpecOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.CommonGatewayRouteSpecOptions.html)
Used as argument in: [GatewayRouteSpec.http](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.GatewayRouteSpec.html#http), [GatewayRouteSpec.http2](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.GatewayRouteSpec.html#http2)

- Source: [`aws-appmesh/lib/gateway-route-spec.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-appmesh/lib/gateway-route-spec.ts#L179)
- Type last changed: v2.2.0 · 15 Dec 2021

## Example

TypeScript:

```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:

```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:

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

C# / .NET:

```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")
        }
    })
});
```

Golang:

```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

- `match`: [HttpGatewayRouteMatch](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.HttpGatewayRouteMatch.html) — The criterion for determining a request match for this GatewayRoute.

  **Default:** matches any path and automatically rewrites the path to '/'

  When path match is defined, this may optionally determine the path rewrite configuration.

- `priority`: number — The priority for the gateway route.

  **Default:** no particular priority

  When a Virtual Gateway has multiple gateway routes, gateway route match
  is performed in the order of specified value, where 0 is the highest priority,
  and first matched gateway route is selected.

- `routeTarget`: [IVirtualService](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.IVirtualService.html) (required) — The VirtualService this GatewayRoute directs traffic to.
