# Path Matching Settings

This reference covers all of Pomerium's **Path Matching Settings**:

- [Path](#path)
- [Prefix](#prefix)
- [Regex](#regex)

## Path

If **Path** is set, the route will only match incoming requests with a path that is an exact match for the specified path.

### How to configure

**Core:**

| **YAML**/**JSON** setting | **Type** | **Usage**    |
| :------------------------ | :------- | :----------- |
| `path`                    | `string` | **optional** |

### Examples

```yaml
routes:
  - from: https://verify.localhost.pomerium.io
    to: http://verify:8000
    path: /admin/some/exact/path
```

**Enterprise:**

**Kubernetes:**

See Kubernetes [Ingress](https://www.pomerium.com/docs/deploy/k8s/ingress.md#regular-expressions-path-matching) for more information

## Prefix

If **Prefix** is set, the route will only match incoming requests with a path that begins with the specified prefix.

### How to configure

**Core:**

| **YAML**/**JSON** setting | **Type** | **Usage**    |
| :------------------------ | :------- | :----------- |
| `prefix`                  | `string` | **optional** |

### Examples

```yaml
from: https://from.example.com
to: https://to.example.com
prefix: /admin
```

**Enterprise:**

**Kubernetes:**

| **Name** | **Type** | **Usage**    |
| :------- | :------- | :----------- |
| `Prefix` | `string` | **optional** |

```yaml
spec:
  ingressClassName: pomerium
  rules:
    - host: example.localhost.pomerium.io
      http:
        paths:
          - backend:
              service:
                name: example
                port:
                  name: http
            path: /
            pathType: Prefix
```

See Kubernetes [Ingress](https://www.pomerium.com/docs/deploy/k8s/ingress.md#set-ingress-annotations) for more information

## Regex

If **Regex** is set, the route will only match incoming requests with a path that matches the specified regular expression. The supported syntax is the same as the Go [regexp package](https://golang.org/pkg/regexp/) which is based on [re2](https://github.com/google/re2/wiki/Syntax).

### How to configure

**Core:**

| **YAML**/**JSON** setting | **Type** | **Usage**    |
| :------------------------ | :------- | :----------- |
| `regex`                   | `string` | **optional** |

### Examples

```yaml
regex: '^/(admin|superuser)/.*$'
```

**Enterprise:**

**Kubernetes:**

| **Name**     | **Type** | **Usage**    |
| :----------- | :------- | :----------- |
| `path_regex` | `string` | **optional** |

### Examples

```yaml
    ingress.pomerium.io/path_regex: 'true'
  name: example
spec:
  ingressClassName: pomerium
  rules:
    - host: example.localhost.pomerium.io
      http:
        paths:
          - backend:
              service:
                name: example
                port:
                  name: http
            path: ^/(admin|superuser)/.*$
            pathType: ImplementationSpecific
```
