AJAX POST request is failing because of Payload content length
<p>I am trying to consume REST service via ajax. For that I am sending jquery AJAX POST request which is failing with following message.</p>

<pre><code>{"statusCode":400,"error":"Bad Request","message":"Payload content length greater than maximum allowed: 1048576"}
</code></pre>

<p>Payload size that we are trying to send is around 3 mb.</p>

<p>Service API is developed in JAVA and at service API side we have <strong>nginx as Web server and tomcat as application server.</strong></p>

<p>How can I increase payload content length so that we can have resolution to above error?</p>

<p>AJAX is as below:</p>

<pre><code> $.ajax({
        type: "POST",
        crossDomain: true,
        //contentType: "application/json; charset=utf-8",
        beforeSend: function (request) {
          // Headers as below
          setRequestHeadersOfFMAPI(request);
        },
        contentType: "application/json",
        dataType: "json",
        timeout: (3000 * 60 * 10),
        url: urlContext + "/api/v1/application/google_bps_app/metrics/actuals",
        data: JSON.stringify({
          "actuals": activities
        }),

        success: function (data) {

        }
);
</code></pre>