title: Getting response status code: 404, headers when trying to upload a very large JSON string to server using NSMutableURLRequest
body: <p>I'm trying to upload a very large JSON string to server using <code>NSMutableURLRequest</code>. If the length of <code>postData</code> is <code>239741</code> then it is giving the following response :</p>
  
  <pre><code> { status code: 404, headers {
   Connection = "keep-alive";
   "Content-Encoding" = gzip;
   "Content-Type" = "text/html";
   Date = "Fri, 04 Dec 2015 09:12:30 GMT";
   Server = "nginx/1.4.6 (Ubuntu)";
   "Transfer-Encoding" = Identity;
   } }
  </code></pre>
  
  <p>But if I try to post JSON string to server with <code>postData</code> length of 206044, then data gets successfully uploaded to server.</p>
  
  <p>How can I upload a JSON string of unlimited length to a server?</p>
  
  <p>Complete code given below :</p>
  
  <pre><code>NSString *urlString = [NSString stringWithFormat:@“URL Here”];
  NSData *postData = [[NSString stringWithFormat:@"data=%@",postValues] dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
  NSString *postLength = [NSString stringWithFormat:@"%d", (int)[postData length]];
  NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
  [request setValue:[NSString stringWithFormat:@"Token %@",AuthToken] forHTTPHeaderField:@"Authorization"];
  [request setURL:[NSURL URLWithString:urlString]];
  [request setHTTPMethod:@"POST"];
  [request setTimeoutInterval:50];
  [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
  [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
  NSError *error1 = nil;
  
  NSHTTPURLResponse *response=nil;
  NSData *responseData=[NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error1];
  NSLog(@"response is %@",response);
  NSString* responseString=[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
  NSLog(@"response string is %@",responseString);
  if (responseData) {
      NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&amp;error1];
      return json;
  }
  else
      NSLog(@"Error : %@",error1.description);
  </code></pre>