timgavin's avatar

413 Request Entity too Large (Cloudflare)

I'm allowing large file uploads in my Laravel app, and am using Cloudflare. One of my customers told me today that they were unable to upload a 150 MB file and received a 413 Request Entity too Large error. I looked into this and it's actually coming from Cloudflare; they won't allow uploads greater than 100 MB unless you pay through the nose.

Cloudflare suggests that I create a subdomain that isn't tracked by them and upload through that.

My question: how would I do this in Laravel?

I'm using Spatie's Media Library and uploading to the site on which Laravel is installed; how do I use a subdomain within the app?

0 likes
3 replies
Cronix's avatar

You would have to create a subdomain on your server though, along with dns, etc. Just have the document root point to the same /public dir that laravel is in.

1 like
timgavin's avatar

@Cronix Brilliant! Ok, so one thing I didn't mention is that I'm using a load balancer on Forge/DigitalOcean. I can set up the subdomain DNS to point to the load balancer, but I'm curious on setting up the sub domain on the two app servers to point to the app's current directory.

Would I create a new site in Forge and add the subdomain as the URL, then edit the nginx conf file and point the root to the main site?

Please or to participate in this conversation.