Error: request entity too large

后端 未结 21 3101
无人共我
无人共我 2020-11-22 06:36

I\'m receiving the following error with express:

Error: request entity too large
    at module.exports (/Users/michaeljames/Documents/Projects/Proj/mean/node         


        
相关标签:
21条回答
  • 2020-11-22 06:51

    in my case .. setting parameterLimit:50000 fixed the problem

    app.use( bodyParser.json({limit: '50mb'}) );
    app.use(bodyParser.urlencoded({
      limit: '50mb',
      extended: true,
      parameterLimit:50000
    }));
    
    0 讨论(0)
  • 2020-11-22 06:52

    2016, none of the above worked for me until i explicity set the 'type' in addition to the 'limit' for bodyparser, example:

      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-urlencoded' })
    
      app.use(jsonParser);
      app.use(urlencodedParser);
    
    0 讨论(0)
  • 2020-11-22 06:55

    In my case removing Content-type from the request headers worked.

    0 讨论(0)
  • 2020-11-22 06:59

    If someone tried all the answers, but hadn't had any success yet and uses NGINX to host the site add this line to /etc/nginx/sites-available

    client_max_body_size 100M; #100mb
    
    0 讨论(0)
  • 2020-11-22 06:59

    In my case the problem was on Nginx configuration. To solve it I have to edit the file: /etc/nginx/nginx.conf and add this line inside server block:

    client_max_body_size 5M;
    

    Restart Nginx and the problems its gone

    sudo systemctl restart nginx
    
    0 讨论(0)
  • 2020-11-22 06:59

    for me following snippet solved the problem.

    var bodyParser = require('body-parser');
    app.use(bodyParser.json({limit: '50mb'})); 
    
    0 讨论(0)
提交回复
热议问题