title: Why does IE 11 browser randomly have Content-Length=0 for jQuery AJAX POST requests?
body: <p>I'm working on Spring MVC based webapp. </p>
  
  <p>Following are my environment details :-
  <code>Java 1.8.0_162 (64 bit)</code>, <code>Spring 4.3.1</code>, <code>Apache Tomcat 8.0.49</code>, <code>Waffle-1.8.3</code> for SSO, <code>jquery-1.11.3</code> and <code>Google Charts API</code>.</p>
  
  <p>Have put the following JavaScript code in one of the common JS files :-
  <code>$.ajaxSetup({ cache: false });</code></p>
  
  <p>The jQuery AJAX <code>POST</code> requests made to the server work flawlessly in <strong>Mozilla</strong> &amp; <strong>Chrome</strong> browsers. 
  But when it comes to <strong>IE 11</strong> browser, the jQuery AJAX <code>POST</code> requests work without fail only when the window is loaded for the first time. 
  Then fail randomly &amp; once failed, the subsequent requests also fail.</p>
  
  <p>Following are the snapshots of the <strong>Network</strong> tab of the <strong>IE 11</strong> browser:-</p>
  
  <ol>
  <li><p><strong>SUCCESSFUL</strong> ajax <code>POST</code> request :
  <a href="https://i.stack.imgur.com/uyhLd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uyhLd.png" alt="enter image description here"></a></p></li>
  <li><p><strong>FAILED</strong> ajax <code>POST</code> request :
  <a href="https://i.stack.imgur.com/0bPA3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0bPA3.png" alt="enter image description here"></a></p></li>
  </ol>
  
  <p>Both requests have the JSON object in their respective <strong>request</strong> bodies. 
  But, the <code>Content-Length</code> property value is <strong>416</strong> (the total characters of the stringified JSON object) for the successful request &amp; <strong>0</strong> for the failed one.
  For the random failed <code>POST</code> request &amp; the subsequent requests, the <code>Content-Length</code> is always <strong>0</strong>, but the computed JSON object is always present in the request body. 
  In every request, the JSON object is built dynamically.</p>
  
  <p><strong>UPDATE-1 (26March2018)</strong> Following is the <code>Waffle</code> AD authentication configuration defined in the <code>web.xml</code> file :-</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;SecurityFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;waffle.servlet.NegotiateSecurityFilter&lt;/filter-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;principalFormat&lt;/param-name&gt;
          &lt;param-value&gt;fqn&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;roleFormat&lt;/param-name&gt;
          &lt;param-value&gt;both&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;allowGuestLogin&lt;/param-name&gt;
          &lt;param-value&gt;false&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;securityFilterProviders&lt;/param-name&gt;
          &lt;param-value&gt;
              waffle.servlet.spi.NegotiateSecurityFilterProvider
          &lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;waffle.servlet.spi.NegotiateSecurityFilterProvider/protocols&lt;/param-name&gt;
          &lt;param-value&gt;
              Negotiate
              NTLM
          &lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;SecurityFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/welcome.do&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p><em>Only <strong>1</strong> URL i.e., <code>/welcome.do</code> (the initial URL that loads the webapp) is configured to invoke SSO authentication.</em></p>
  
  <p>Following is the JavaScript code that fires AJAX requests :-</p>
  
  <pre><code>function getData() {
      let dashboardFilterParams=new DashboardFilterParams(&lt;passing the arguments to this constructor&gt;);
      //alert(JSON.stringify(dashboardFilterParams));
      //console.dir(dashboardFilterParams);
      $.ajax({
              url: str_THIS_WA_URL+"/xyz/abcdXYZ.do?httpReqType=ajaxReq",
              data: JSON.stringify(dashboardFilterParams),
              dataType: "json",
              contentType: "application/json",
              mimeType: "application/json",
              type: "POST",
              success:function(responseData){
                          if(responseData &amp;&amp; "success"===responseData.reqResult) {
                              //populating tables &amp; drawing charts using Google Charts JS API if successfully fetched the data
                          } else {
                              //showing error message
                          }
                      },
              error:function(data,status,er) {
                          showTheMessage("danger","Error getting data");
                          console.log("error: "+JSON.stringify(data)+"\n status: "+status+"\n er:"+er);
                      }
       });
  }
  </code></pre>
  
  <p><strong>IE 11</strong> version details :</p>
  
  <p><a href="https://i.stack.imgur.com/KubZU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KubZU.png" alt="IE 11 version details"></a></p>
  
  <p>Also, I'm using the <strong>Google Charts API</strong> to render charts on the page. For which the requests are fired to the Google Charts API server. Does this effect in IE browser? </p>
  
  <p>What is the solution to make it work in <strong>IE 11</strong> browser?</p>
  
  <p>Answers to <strong>Federico klez Culloca</strong>'s questions in the comments section :</p>
  
  <ol>
  <li><p>No error in the request (client) side. But the response from the server says <code>The request sent by the client was syntactically incorrect</code>. and the response headers <code>Response    HTTP/1.1 400 Bad Request</code>.</p></li>
  <li><p>There is absolute no difference in the request body contents.</p></li>
  <li><p>The <code>str_THIS_WA_URL variable</code> points to the same domain as the webapp, i.e., the AJAX requests are within the current domain.</p></li>
  </ol>
  
  <p>Adding timestamp (on <strong>shawn</strong>'s suggestion in the comments section below) to the URL did not solve the problem.</p>