> ## Documentation Index
> Fetch the complete documentation index at: https://datum-4926dda5-docs-api-reference-demo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# HTTPRouteFilter

> HTTPRouteFilter is a custom Envoy Gateway HTTPRouteFilter which provides extended traffic processing options such as path regex rewrite, direct response and more.

<Note>
  API resource reference for **HTTPRouteFilter**, an [Envoy Gateway](/api/networking/envoy/overview) extension resource. To create or change one, see [Changing resources](/datumctl/resources/changing); to inspect, see [Reading resources](/datumctl/resources/reading).
</Note>

<Warning>
  This resource is part of the `v1alpha1` API and is subject to change. Fields and behavior may change in future releases.
</Warning>

## Identity

|         |                         |
| ------- | ----------------------- |
| Group   | `gateway.envoyproxy.io` |
| Version | `v1alpha1`              |
| Kind    | `HTTPRouteFilter`       |
| Scope   | Project                 |

## Overview

An `HTTPRouteFilter` is an Envoy Gateway extension to the Gateway API, defined by the [Envoy Gateway API](https://gateway.envoyproxy.io/docs/api/extension_types/), that provides extended HTTP traffic processing options beyond the standard filters. Use it when a route needs behavior such as rewriting URL path or host, returning a fixed direct response, or injecting credentials into requests before they reach a backend.

You reference an `HTTPRouteFilter` from an `HTTPRoute` (via an extension-reference filter) so the extended processing applies to the matching traffic within a Project.

## Spec fields

| Field                                 | Type    | Required | Description                                                                                                                                                   |
| ------------------------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `spec.credentialInjection`            | Object  | No       | Injects credentials into the request before forwarding to the backend. Useful when the backend requires credentials that the original request does not carry. |
| `spec.credentialInjection.credential` | Object  | Yes\*    | The credential to inject. Required when `credentialInjection` is set.                                                                                         |
| `spec.credentialInjection.header`     | string  | No       | Name of the header the credentials are injected into. Defaults to the `Authorization` header.                                                                 |
| `spec.credentialInjection.overwrite`  | boolean | No       | Whether to overwrite the value if the injected header already exists. Defaults to `false`.                                                                    |
| `spec.directResponse`                 | Object  | No       | Returns a fixed response instead of forwarding to a backend.                                                                                                  |
| `spec.directResponse.body`            | Object  | No       | Body of the response.                                                                                                                                         |
| `spec.directResponse.contentType`     | string  | No       | Content type of the response, set in the `Content-Type` header.                                                                                               |
| `spec.directResponse.statusCode`      | integer | No       | HTTP status code of the response. Defaults to `200` if unset.                                                                                                 |
| `spec.urlRewrite`                     | Object  | No       | Rewrites HTTP URL components such as path and host.                                                                                                           |
| `spec.urlRewrite.hostname`            | Object  | No       | Value used to replace the Host header during forwarding.                                                                                                      |
| `spec.urlRewrite.path`                | Object  | No       | Defines a path rewrite.                                                                                                                                       |

<Info>
  `*` `credentialInjection.credential` is required only when the `credentialInjection` block is present.
</Info>

This resource has no `status` field.

## Usage

```yaml theme={null}
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: HTTPRouteFilter
metadata:
  name: fixed-maintenance-response
spec:
  directResponse:
    statusCode: 503
    contentType: text/plain
```

```bash theme={null}
datumctl apply -f httproutefilter.yaml --project my-project
datumctl get httproutefilters --project my-project
datumctl describe httproutefilter fixed-maintenance-response --project my-project
```

<Tip>
  Run `datumctl explain httproutefilters --recursive` to see the full, live field tree for this resource.
</Tip>
