proxy_buffering off; is set in an nginx configuration?location /api/ {
proxy_pass http://backend;
proxy_buffering off;
}Setting proxy_buffering off; disables buffering, so nginx sends data to the client as soon as it receives it from the backend. This reduces latency, especially for slow or large responses.
The directive proxy_buffering on; enables buffering. proxy_buffer_size sets the size of the buffer for the first part of the response, and proxy_buffers sets the number and size of additional buffers.
When proxy buffering is enabled, nginx waits to fill buffers before sending data to the client, causing delay. Disabling buffering streams data immediately, reducing perceived latency.
When backend is slow, disabling proxy buffering lets nginx send data to clients as soon as it arrives, improving perceived responsiveness.
Proxy buffering stores response data in memory or disk before sending to clients, increasing memory use but allowing nginx to serve clients efficiently and reduce backend load.