# KubernetesIngressResource.withIngressHostAndPath

- Module: [Aspire.Hosting.Kubernetes](/reference/api/typescript/aspire.hosting.kubernetes.md)
- Defined on: [KubernetesIngressResource](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesingressresource.md)
- Version: `13.4.0-preview.1.26281.18`
- Kind: `method`

Adds a host-scoped path rule to the ingress. The rule matches traffic for the specified host and path, forwarding it to the given endpoint's backing Kubernetes service.

## Definition

```typescript
interface KubernetesIngressResource {
  // ... omitted for brevity
  withIngressHostAndPath(
      host: string,
      path: string,
      endpoint: EndpointReference,
      pathType?: IngressPathType): KubernetesIngressResource;
}
```

## Signature

```typescript
withIngressHostAndPath(
    host: string,
    path: string,
    endpoint: EndpointReference,
    pathType?: IngressPathType): KubernetesIngressResource
```

## Parameters

- `host` (`string`)
- `path` (`string`)
- `endpoint` (`EndpointReference`)
- `pathType` ([IngressPathType](/reference/api/typescript/aspire.hosting.kubernetes/ingresspathtype.md)) `optional` `= Prefix`

## Returns

[KubernetesIngressResource](/reference/api/typescript/aspire.hosting.kubernetes/kubernetesingressresource.md) `builder`

## Defined on

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