Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithGatewayHostRoute

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

Signature

methodWithGatewayHostRoutebuilder
Adds a host-and-path-based routing rule to the gateway. The rule matches traffic for the specified host and path, routing it to the given endpoint's backing Kubernetes service. This generates an HTTPRoute resource with a hostnames filter.
WithGatewayHostRoute(
host string,
path string,
endpoint EndpointReference,
options ...*WithGatewayHostRouteOptions,
) KubernetesGatewayResource
hoststringThe hostname to match (e.g., "api.example.com").
pathstringThe URL path to match. Must start with /.
endpointEndpointReferenceThe endpoint reference identifying the target service and port.
options...*WithGatewayHostRouteOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithGatewayHostRouteOptions 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: