Prometheus Computing
Development, Support, Consultancy
413 Error when uploading files using BeyondCode Expose & Nginx

413 Error when uploading files using BeyondCode Expose & Nginx

DevOps

PHP
Ubuntu

Published: September 14, 2024

Author: Andrew Arscott

If you are tunneling your application using BeyondCode's Expose - you might encounter a 413 error when trying to upload files. This is due to a max body size limit caused by Nginx configuration. Fortunately, the fix for this is nice and easy. You will need to SSH into the server hosting the Expose server to make these changes.

Load the Nginx config file using an editor like nano:

sudo nano /etc/nginx/nginx.conf

This will load the config file. Next you need to add a new parameter after the http section which will be as follows:

client_max_body_size 200M;

Which, in situe, should look something like this

http {
	client_max_body_size 200M;

Save these changes and exit from nano. Finally, restart nginx:

sudo systemctl restart nginx

Confirm this has fixed it by uploading a large file and the file should pass through.

If you still have issues with this, such as your tunnel crashing, it could be a PHP limit on the server needs to be increased too. You can change these limits in your php.ini file and again you will need to restart nginx for the changes to take effect.