MEANJS : 413 (Request Entity Too Large) MEANJS : 413 (Request Entity Too Large) mongoose mongoose

MEANJS : 413 (Request Entity Too Large)


You can add following to express config:

app.use(bodyParser.urlencoded({limit: '50mb'}));app.use(bodyParser.json({limit: '50mb'}));

Basically you need to configure Express webserver to accept bigger request size. Replace 50mb with whatever maxsize you want to accept.

Hope this helps!!!


2016, there may have been changes, i needed to set the 'type' in addition to the 'limit' for bodyparser, example: var bodyParser = require('body-parser');

  var app = express();  var jsonParser       = bodyParser.json({limit:1024*1024*20, type:'application/json'});  var urlencodedParser = bodyParser.urlencoded({ extended:true,limit:1024*1024*20,type:'application/x-www-form-urlencoding' })  app.use(jsonParser);  app.use(urlencodedParser);


Recently, I confronted with this issue and I just added app.use(bodyParser.json({ limit: "50mb" })); this one line in my express app, it just worked :)

And also one more thing don't forget to add above code line before app.use(bodyParser.json()) this otherwise, it won't work.

Whatever you set values regarding bodyparser you've to do before the above code line.

Because, express will go back to its default values and your change won't get effect. I hope this might help :)