Big Data to Tomcat Behind Nginx

In a Web application I created, I need to upload some data to a Java Servlet for further processing. I wish JavaScript could be more powerful so that I can process everything in the front end, but I could not find a good JavaScript library for the job.

Everything works well until some big changes got in – it stopped working sometimes and the pattern is not quite consistent. Initially I thought it was because of long time processing at the server side.

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

It turned out it’s not the case later when I have more to look into it later. From the browser console in developer tools, I found the following print out.

Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

It’s clear that the server rejected the big data. Because my tomcat server runs behind Nginx, it’s not clear which server caused it. A quick look at the tomcat access log showed that there is no URL for the server. So it’s most like that Nginx caused the problem.

With that in mind, a quick Internet search with keyword with Nginx and above error message got me many articles. The solution is actually quite simple: add the following line inside the server section in the /etc/nginx/nginx.conf file as follows:

client_max_body_size 10M;

Now the Nginx will allow 10M in the request body – a limit that is good enough for my task.

With the change of configuration, the Nginx server must be restarted using the following the command:

# systemctl restart nginx
This entry was posted in Applications & Tools and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. Posted October 18, 2015 at 3:32 am | Permalink

    Hi! If you set client_max_body_size to 0 the system stops checking the body size.

  2. Posted October 20, 2015 at 3:05 am | Permalink

    Thanks a lot Serhii, will give it a try!

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.