A 413 means some layer between the browser and your code rejected the request body for being too large. You usually have to raise the limit in two or three places — Nginx, PHP, and the framework.
The Error
413 Request Entity Too Large
Fix 1: Nginx
http {
client_max_body_size 50M; # in the http, server, or location block
}Then reload: sudo nginx -t && sudo systemctl reload nginx.
Fix 2: PHP (if applicable)
; php.ini
upload_max_filesize = 50M
post_max_size = 52M ; must be >= upload_max_filesizeFix 3: Node / Express
app.use(express.json({ limit: "50mb" }));
app.use(express.urlencoded({ limit: "50mb", extended: true }));Restart Everything
PHP changes need an php-fpm restart; Nginx needs a reload. Forgetting to restart is why people think the fix 'didn't work'.
