I am looking to limit the size of the client body
based on the content type in nginx.
location / {
if ($content_type = "application/json") {
client_max_body_size 1M;
client_body_buffer_size 512K;
}
...
...
}
I've tried the above if
condition which fails with below error.
nginx: [emerg] "client_max_body_size" directive is not allowed here
I have also tried using this without any effect
location ~* ^.+\.json {
client_max_body_size 1M;
client_body_buffer_size 512K;
}