Should I enable client_max_body_size, proxy_request_buffering and proxy_buffering?

Should client_max_body_size, proxy_request_buffering and proxy_buffering be enabled on Ubuntu server when running Flask application? What client_max_body_size is recomented?

1 Answer

It depends on what kind of requests you are waiting from clients.

For example, if your application support file uploading, you should increase client_max_body_size to value of max allowed file size + 1Mb

I recommend to set increased client_max_body_size for specified location only.

location /my_upload_location/ { client_max_body_size 31m;
}

By default client_max_body_size = 1Mb. This means that any request from client can have Content-Length header with value less or equal 1Mb.

You should enable proxy_request_buffering only if you have more then 1 application backend and need to resend request to another backend if first one return an error.

In other case enabling proxy_request_buffering just increase response time.

Enabling proxy_buffering allow you to cache backend responses. If proxy_buffering is switched of nginx will not cache anything from your application backend.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like