0

I'm getting a visual error when trying to upload a file with 2.6MB. This says:

Request Entity Too Large.

enter image description here

Even with upload configurations enabled to 20MB.

enter image description here

I've read that this error is related to bodyParser limit, so i tried to solve this changing lines on nodebb/src/webserver.js lines 157 and 158

From this

app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());

to this (with no success)

app.use(bodyParser.urlencoded({ extended: true, limit: '20mb'}));
app.use(bodyParser.json({limit: '20mb', type: 'application/json'}));

I've also searched in Nodebb repository, but there's no problem like that. If someone could help me on that, i will be greatful.

Marcos Mendes
  • 810
  • 1
  • 6
  • 14
  • Seems to be an Express related error and googling "nodejs Request Entity Too Large" brings ~50k results... – marekful Jan 29 '18 at 05:12
  • Possible duplicate of [Error: request entity too large](https://stackoverflow.com/questions/19917401/error-request-entity-too-large) – marekful Jan 29 '18 at 05:12

1 Answers1

1

If your app is behind nginx you need to set the limit in nginx as well. Add client_max_body_size 5M; into your nginx config.

Barış Uşaklı
  • 13,003
  • 7
  • 37
  • 62