Skip to content
Version 2026.6.3 is the latest release with the newest features, but gets no long-term support. To stay supported, upgrade with every new release or use a quarterly stable release instead.

Buffering

Page as Markdown

Fine-tune connection speeds for read and write operations by setting a connection buffer limit.

About buffer limits

By default, agentgateway allows up to 2mb of HTTP body to be buffered into memory for each gateway. For large requests that must be buffered and that exceed the default buffer limit, agentgateway either disconnects the connection to the downstream service if headers were already sent, or returns a 413 HTTP response code. To make sure that large requests can be sent and received, you can specify the maximum number of bytes that can be buffered between the gateway and the downstream service. Alternatively, when using agentgateway as an edge proxy, configuring the buffer limit can be important when dealing with untrusted downstreams. By setting the limit to a small number, such as 32768 bytes (32KiB), you can better guard against potential attacks or misconfigured downstreams that could excessively use the proxy’s resources.

The buffer limit is configured at the Gateway level via a EnterpriseAgentgatewayPolicy.

Before you begin

  1. Set up an agentgateway proxy.
  2. Install the httpbin sample app.

Set up buffer limits per gateway

Use a EnterpriseAgentgatewayPolicy to set a buffer limit on your Gateway, which applies to all routes served by the Gateway.

  1. Create an EnterpriseAgentgatewayPolicy that sets the maximum HTTP body buffer size.

    kubectl apply -f- <<EOF
    apiVersion: enterpriseagentgateway.solo.io/v1alpha1
    kind: EnterpriseAgentgatewayPolicy
    metadata:
      name: maxbuffer
      namespace: agentgateway-system
    spec:
      targetRefs:
      - kind: Gateway
        name: agentgateway-proxy
        group: gateway.networking.k8s.io
      frontend:
        http:
          maxBufferSize: 2097152
    EOF
    SettingDescription
    maxBufferSizeThe maximum size of HTTP body that can be buffered into memory.
  2. Port-forward the gateway proxy on port 15000.

    kubectl port-forward deployment/agentgateway-proxy -n agentgateway-system 15000
  3. Get the config dump and verify that the policy is set as you configured it.

    Example jq command:

    curl -s http://localhost:15000/config_dump | jq '[.policies[] | select(.policy.frontend != null and .policy.frontend.hTTP != null and .policy.frontend.hTTP.maxBufferSize != null)] | .[0]'

    Example output:

    http://localhost:15000/config_dump
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    {
      "key": "frontend/agentgateway-system/maxbuffer:frontend-http:agentgateway-system/agentgateway-proxy",
      "name": {
        "kind": "AgentgatewayPolicy",
        "name": "maxbuffer",
        "namespace": "agentgateway-system"
      },
      "target": {
        "gateway": {
         "gatewayName": "agentgateway-proxy",
         "gatewayNamespace": "agentgateway-system",
         "listenerName": null
       }
     },
     "policy": {
       "frontend": {
         "hTTP": {
           "maxBufferSize": 2097152,
           "http1MaxHeaders": null,
           "http1IdleTimeout": null,
           "http2WindowSize": null,
           "http2ConnectionWindowSize": null,
           "http2FrameSize": null,
           "http2KeepaliveInterval": null,
           "http2KeepaliveTimeout": null
         }
       }
     }
    }

Cleanup

You can remove the resources that you created in this guide.
kubectl delete EnterpriseAgentgatewayPolicy maxbuffer -n agentgateway-system