Fixing 413 Errors When Uploading Files Through Expose
If you are tunnelling your application using BeyondCode's Expose and encounter a 413 Request Entity Too Large error when uploading files, the culprit is Nginx's default client_max_body_size limit on the server hosting your Expose instance.
Fortunately, the fix is straightforward. You will need SSH access to that server.
Updating the Nginx Config
Open the Nginx config file:
sudo nano /etc/nginx/nginx.conf
Add the client_max_body_size directive inside the http block:
http {
client_max_body_size 200M;
Adjust 200M to whatever limit suits your use case. Save and exit.
Then restart Nginx for the change to take effect:
sudo systemctl restart nginx
Try uploading a large file through the tunnel — it should now pass through without error.
Still Having Issues?
If uploads are still failing or the tunnel crashes mid-upload, the PHP configuration on the server may also need adjusting. Two php.ini values are worth checking:
upload_max_filesize = 200M
post_max_size = 200M
After updating php.ini, restart Nginx again:
sudo systemctl restart nginx
Make sure both client_max_body_size in Nginx and the PHP limits are set consistently — if one is lower than the other, it will still be the bottleneck.
Have thoughts on this? Get in touch.

