Request too large || body empty when increasing limit

I’m sending a json-ecoded POST request from outside to meteor which shall be captured by iron router like this: () {
    this.route('api', {
        path: '/api',
        where: 'server',

        action: function() {
            var o = this.request.body

This works when the request is small. When it is about 1 MB, I get a Error: Request Entity Too Large. So I used:

Router.configureBodyParsers = function() {
        limit: '500mb'

to increase the request size limit. But then, this.request.body is empty. What to do?

solved :wink:

Router.onBeforeAction(Iron.Router.bodyParser.json({limit: '50mb'}));

did the trick

1 Like


Can you be a bit more specific on what you do because I have the exact same problem when it is about 1MB ?

Router.configureBodyParsers = function() {
        limit: '500mb'

this doesn’t work for me

Thanks a lot

I just did
Router.onBeforeAction(Iron.Router.bodyParser.json({limit: '50mb'}));
in server context, nothing around it, no function like you wrote.

But I also found out that nginx had another limit, and because we use nginx as a proxy around meteor, I added this to nginx.conf as well:
client_max_body_size 500M;

Thank you for your reply !

I use Nginx too. So I did what you’ve shown.

Unfortunately it is not working for me …

I put Router.onBeforeAction... in Meteor.startup and set client_max_body_size 500M; in Nginx.

I don’t know what to do next :frowning:

Hmm. Restartet nginx? Try not to use Meteor.startup() for this one, I remember I had some weird problems once. Is your request a POST?

So anywhere in server side but not in the startup function ? Yes my request is a POST.

Yes anywhere there on the server side, just a try to make sure there is nothing else interfering.

So I tried locally without nginx as a proxy and still it’s not working. So I suppose IRON Router is the problem…

what’s your version of iron-router ?

iron router 1.0.12
meteor version is 1.3-modules-beta.8

ok so I solved it I just write :

    extended : true,
    limit: '200mb'

not in startup but just before all my routes definition…

Well I don’t understand why is it working now but hey !

Thank you so much @quape for the time you take for helping me :slight_smile:


Oh yes, I forgot to mention that my POST only contained JSON data. So obviously there is a urlencoded() function as well for other form data.
Great that it works now!

my post is also only Json data lol