1

I know a little about proxy_cache that is used to make cache for static file requested from client. But proxy_buffer really confused me. Does it buffer for proxied backend servers?

And I also see client_max_body_size and client_body_buffer_size appears in nginx.conf with proxy_cache and proxy_cache after it. Does it matter?

3

Proxy buffer is related to the way how nginx handles the response received from the proxied server.

When buffering is enabled, nginx receives the response from the proxied server immediately into memory buffers, and closes the connection to the proxied server after having received the response. It then sends the response to the client from its buffers.

When buffering is disabled, nginx sends the response synchronously to the client. This means that the connection to the proxied server is open as long as it takes to send the complete response to the client.

Buffering is therefore a method of temporarily storing the response for each individual client separately to allow the connection to the proxied server to close earlier.

Proxy caching is the process of nginx storing the data locally, and serving the cached copy of data to multiple clients. This means that the proxied server is not queried for every client request, but the data is served from the cache if the cached data is still considered valid (lifetime has not passed).

Proxy caching makes the load on proxied server much less, but it might cause old data to be sent to clients.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.