8

While uploading a video file to Amazon S3, the file hits 100% in uploading, then i get the response 413 Request Entity Too Large. How do i fix this so that i can upload video files to Amazon S3?

Im using Nodejs, Express, Heroku, Cloudflare and Amazon S3.

Jan Egil
  • 81
  • 1
  • 1
  • 4

3 Answers3

7

What is your webserver nginx,apache ..etc ?

For nginx, you need to find the nginx.conf file.It should be in the

/etc/nginx/nginx.conf

open up with vi or nano

vi /etc/nginx/nginx.conf

find the client_max_body_size 2M

client_max_body_size 2M

you can edit this end done. M = Megabyte G = Gigabyte

if that doesnt work you need to change php.ini for that to work

This sets the maximum amount of memory in bytes that a script is allowed to allocate

memory_limit = 32M

The maximum size of an uploaded file.

upload_max_filesize = 2M

Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize

post_max_size = 3M

UPDATED FOR HEROKU

if you are using Express v4+ you can use

app.use(bodyParser({limit: '5mb'}));

but make sure this line is above

app.use(bodyParser.json());

otherwise it will not work

Community
  • 1
  • 1
Mehmetali Saraç
  • 352
  • 2
  • 4
  • 15
4

Since you mentioned Cloudflare, that is likely the culprit. They enforce a maximum upload size of 100MB for their free plan. Since you’re using AWS S3, you can generate pre-signed URLs and upload directly to your S3 bucket instead of going through your server.

ezekg
  • 924
  • 10
  • 20
  • 1
    Wow, thanks for that. I've been puzzled why my large uploads would not pass, I would have never suspected Cloudflare – Overdrivr Jan 18 '19 at 15:12
0

I use free Heroku server, not sure what webserver they use.. And also i have free cloudflare account witch im trying to pause for this application, but with no success.

Jan Egil
  • 81
  • 1
  • 1
  • 4