Files
zeekayandHanzo Dev 15d100931d
Hanzo CI/CD / cicd (push) Failing after 9m46s
CI/CD / cicd (push) Failing after 10m4s
Name the ingress in the docs, and fix what that exposed
Most of it was stale, not cosmetic: the docs taught `TRAEFIK_*` env,
`traefik.http.*` labels, `traefik.ingress.kubernetes.io/` annotations,
`.traefik.yml` plugins and `traefik_*` metrics. This binary answers to
`INGRESS_*`, `ingress.http.*`, `ingress.kubernetes.io/`, `.ingress.yml` and
`ingress.*` — a reader following the old text configured nothing.

Two were worse than stale. Gateway API examples gave `group: traefik.io` for an
IngressService backendRef, which kubernetes.go:1265 refuses against hanzo.ai.
The contributing guide built with `github.com/traefik/ingress` ldflags against
a module that is `github.com/hanzoai/ingress/v3`.

script/code-gen.sh globs `hanzo.ai_*.yaml` and matched nothing — the per-CRD
dumps had been deleted and never regenerated, so `cat` failed the script under
`set -e`. controller-gen v0.19.0 restores all ten; they concatenate
byte-for-byte into the committed definition and fixture.

CHANGELOG.md is untouched: 6,789 lines of imported release history, where a
rewrite would falsify the record rather than rebrand it. `@traefiklabs/faency`,
`traefik/whoami`, k3s's `--disable=traefik`, the `traefik.io` CRD group and the
MIT attribution stay — upstream's addresses, not our brand.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 13:01:19 -07:00

6.4 KiB
Raw Permalink Blame History

title, description
title description
Hanzo Ingress Buffering Documentation The HTTP buffering middleware in Hanzo Ingress limits the size of requests that can be forwarded to Services. Read the technical documentation.

Buffering

How to Read the Request before Forwarding It {: .subtitle }

The Buffering middleware limits the size of requests that can be forwarded to services.

With Buffering, Hanzo Ingress reads the entire request into memory (possibly buffering large requests into disk), and rejects requests that are over a specified size limit.

This can help services avoid large amounts of data (multipart/form-data for example), and can minimize the time spent sending data to a service.

Configuration Examples

# Sets the maximum request body to 2MB
labels:
  - "ingress.http.middlewares.limit.buffering.maxRequestBodyBytes=2000000"
# Sets the maximum request body to 2MB
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
  name: limit
spec:
  buffering:
    maxRequestBodyBytes: 2000000
# Sets the maximum request body to 2MB
- "ingress.http.middlewares.limit.buffering.maxRequestBodyBytes=2000000"
# Sets the maximum request body to 2MB
http:
  middlewares:
    limit:
      buffering:
        maxRequestBodyBytes: 2000000
# Sets the maximum request body to 2MB
[http.middlewares]
  [http.middlewares.limit.buffering]
    maxRequestBodyBytes = 2000000

Configuration Options

maxRequestBodyBytes

Optional, Default=0

The maxRequestBodyBytes option configures the maximum allowed body size for the request (in bytes).

If the request exceeds the allowed size, it is not forwarded to the service, and the client gets a 413 (Request Entity Too Large) response.

labels:
  - "ingress.http.middlewares.limit.buffering.maxRequestBodyBytes=2000000"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
  name: limit
spec:
  buffering:
    maxRequestBodyBytes: 2000000
- "ingress.http.middlewares.limit.buffering.maxRequestBodyBytes=2000000"
http:
  middlewares:
    limit:
      buffering:
        maxRequestBodyBytes: 2000000
[http.middlewares]
  [http.middlewares.limit.buffering]
    maxRequestBodyBytes = 2000000

memRequestBodyBytes

Optional, Default=1048576

You can configure a threshold (in bytes) from which the request will be buffered on disk instead of in memory with the memRequestBodyBytes option.

labels:
  - "ingress.http.middlewares.limit.buffering.memRequestBodyBytes=2000000"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
  name: limit
spec:
  buffering:
    memRequestBodyBytes: 2000000
- "ingress.http.middlewares.limit.buffering.memRequestBodyBytes=2000000"
http:
  middlewares:
    limit:
      buffering:
        memRequestBodyBytes: 2000000
[http.middlewares]
  [http.middlewares.limit.buffering]
    memRequestBodyBytes = 2000000

maxResponseBodyBytes

Optional, Default=0

The maxResponseBodyBytes option configures the maximum allowed response size from the service (in bytes).

If the response exceeds the allowed size, it is not forwarded to the client. The client gets a 500 (Internal Server Error) response instead.

labels:
  - "ingress.http.middlewares.limit.buffering.maxResponseBodyBytes=2000000"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
  name: limit
spec:
  buffering:
    maxResponseBodyBytes: 2000000
- "ingress.http.middlewares.limit.buffering.maxResponseBodyBytes=2000000"
http:
  middlewares:
    limit:
      buffering:
        maxResponseBodyBytes: 2000000
[http.middlewares]
  [http.middlewares.limit.buffering]
    maxResponseBodyBytes = 2000000

memResponseBodyBytes

Optional, Default=1048576

You can configure a threshold (in bytes) from which the response will be buffered on disk instead of in memory with the memResponseBodyBytes option.

labels:
  - "ingress.http.middlewares.limit.buffering.memResponseBodyBytes=2000000"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
  name: limit
spec:
  buffering:
    memResponseBodyBytes: 2000000
- "ingress.http.middlewares.limit.buffering.memResponseBodyBytes=2000000"
http:
  middlewares:
    limit:
      buffering:
        memResponseBodyBytes: 2000000
[http.middlewares]
  [http.middlewares.limit.buffering]
    memResponseBodyBytes = 2000000

retryExpression

Optional, Default=""

You can have the Buffering middleware replay the request using retryExpression.

??? example "Retries once in the case of a network error"

```yaml tab="Docker & Swarm"
labels:
  - "ingress.http.middlewares.limit.buffering.retryExpression=IsNetworkError() && Attempts() < 2"
```

```yaml tab="Kubernetes"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
  name: limit
spec:
  buffering:
    retryExpression: "IsNetworkError() && Attempts() < 2"
```

```yaml tab="Consul Catalog"
- "ingress.http.middlewares.limit.buffering.retryExpression=IsNetworkError() && Attempts() < 2"
```

```yaml tab="File (YAML)"
http:
  middlewares:
    limit:
      buffering:
        retryExpression: "IsNetworkError() && Attempts() < 2"
```

```toml tab="File (TOML)"
[http.middlewares]
  [http.middlewares.limit.buffering]
    retryExpression = "IsNetworkError() && Attempts() < 2"
```

The retry expression is defined as a logical combination of the functions below with the operators AND (&&) and OR (||). At least one function is required:

  • Attempts() number of attempts (the first one counts)
  • ResponseCode() response code of the service
  • IsNetworkError() whether the response code is related to networking error

Content-Length

See Best Practices: Content‑Length