Monday, 23 December 2019

NGINX: client_max_body_size: Maximum allowed payload size

client_max_body_size is used to set the the maximum allowed request payload size.

Syntax:  client_max_body_size size;
Default: client_max_body_size 1m;
Context: http, server, location

Example
client_max_body_size 4m;

What if request payload exceeds the configured size?
NGINX send 413 (Request Entity Too Large) error.

nginx.conf
events {
}

http {
    include mime.types;

    # Buffer size for POST submissions
    client_body_buffer_size 10K;
    client_max_body_size 4m;

    server {
        listen 9090;

        server_name localhost;

        location = /about{
            return 200 "Hello Welcome to NGINX";
        }

        location = /not_found{
            return 404 "File can't be found";
        }
    }
}




Previous                                                    Next                                                    Home

No comments:

Post a Comment