Limit payload size using a reverse-proxy or a middleware
http {
# Limit the body size for ALL incoming requests to 1 MB
}
server {
...
# Limit the body size for incoming requests to this specific server block to 1 MB
location /upload {
...
# Limit the body size for incoming requests to this route to 1 MB
client_max_body_size 1m;
}