title: proxy-buffering keywords:
The proxy-buffering Plugin disables nginx proxy buffering for the configured route. When proxy buffering is disabled, nginx streams the upstream response directly to the client without accumulating it in memory or on disk first.
This is particularly useful for:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| disable_proxy_buffering | boolean | No | false | When set to true, disables proxy_buffering for this route, enabling streaming responses. |
The examples below demonstrate how you can configure the proxy-buffering Plugin for different scenarios.
:::note You can fetch the admin_key from config.yaml and save to an environment variable with the following command:
admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g')
:::
The following example disables proxy buffering for a route that serves Server-Sent Events (SSE):
curl -i http://127.0.0.1:9180/apisix/admin/routes/1 \ -H "X-API-KEY: $admin_key" -X PUT -d ' { "uri": "/sse", "plugins": { "proxy-buffering": { "disable_proxy_buffering": true } }, "upstream": { "type": "roundrobin", "nodes": { "127.0.0.1:1980": 1 } } }'
Send a request to the route:
curl -i -N -H "Accept: text/event-stream" http://127.0.0.1:9080/sse
Because disable_proxy_buffering is true, nginx streams each SSE event from the upstream to the client as it arrives, without buffering.
To remove the proxy-buffering Plugin, delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.
curl -i http://127.0.0.1:9180/apisix/admin/routes/1 \ -H "X-API-KEY: $admin_key" -X PUT -d ' { "uri": "/sse", "upstream": { "type": "roundrobin", "nodes": { "127.0.0.1:1980": 1 } } }'