# WithIngressPath

- Module: [Aspire.Hosting.Kubernetes](/reference/api/go/aspire.hosting.kubernetes.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`KubernetesIngressResource`](/reference/api/go/aspire.hosting.kubernetes/kubernetesingressresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Adds a path-based rule to the ingress. The rule matches each hostname configured with `WithHostname`, or all hosts when no hostname is configured, and forwards matching traffic to the endpoint's backing Kubernetes service.

## Definition

```go
func (KubernetesIngressResource) WithIngressPath(
    path string,
    endpoint EndpointReference,
    options ...*WithIngressPathOptions,
) KubernetesIngressResource
```

## Parameters

- `path` (`string`) -- The URL path to match (e.g., `"/"` or `"/api"`). Must start with `/`.
- `endpoint` (`EndpointReference`) -- The endpoint reference identifying the target service and port.
- `options` (`...*WithIngressPathOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithIngressPathOptions` argument.

- `PathType` ([`*IngressPathType`](/reference/api/go/aspire.hosting.kubernetes/ingresspathtype.md)) -- The path matching strategy. Defaults to `Prefix`.

## Returns

[`KubernetesIngressResource`](/reference/api/go/aspire.hosting.kubernetes/kubernetesingressresource.md) -- The resource builder.

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

## Applies to

- [`KubernetesIngressResource`](/reference/api/go/aspire.hosting.kubernetes/kubernetesingressresource.md)
