Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithGatewayPathRoute

Method
📦 Aspire.Hosting.Kubernetes v13.6.5-preview.1.26559.7
func (KubernetesGatewayResource) WithGatewayPathRoute(
path string,
endpoint EndpointReference,
options ...*WithGatewayPathRouteOptions,
) KubernetesGatewayResource

Signature

methodWithGatewayPathRoutebuilder
Adds a path-based routing rule to the gateway. The rule matches each hostname configured with WithHostname, or all hosts when no hostname is configured, and routes matching traffic to the endpoint's backing Kubernetes service. This generates an HTTPRoute resource attached to the Gateway.
WithGatewayPathRoute(
path string,
endpoint EndpointReference,
options ...*WithGatewayPathRouteOptions,
) KubernetesGatewayResource
pathstringThe URL path to match (e.g., "/" or "/api"). Must start with /.
endpointEndpointReferenceThe endpoint reference identifying the target service and port.
options...*WithGatewayPathRouteOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithGatewayPathRouteOptions argument.

PathType*GatewayPathMatchTypeThe path matching strategy. Defaults to PathPrefix.
KubernetesGatewayResource

The resource builder.

Returns a handle; failures surface later via Err().

Applies to

This method applies to the following types: