0

AngularJs $http.post() does not send data if i sending data is huge

I want to store one task to my db. If amount of data in assignedMember is more than 175 it will not send got 404 error but If amount of data in assignedMember is lass than 175 it will send success and store my db. Any idea about this. I dont what wrong with me. Please help me thank you

This is my json data

$scope.task=

{
     "title": "My Title",
     "description": "My Description",
     "assignedMember": [
      {
           "userId": "51b701dae4b0dd92df2c32d1",
           "status": "ASSIGNED"
      },
      {
           "userId": "52de0811e4b04615ce7ed6bd",
           "status": "ASSIGNED"
      },
      {
           "userId": "559f8e97e4b0a5cdcd66bb76",
           "status": "ASSIGNED"
      },
        .
        .
        .
        .
        .
        .etc upto 500 data
     ]
}   

This is my post request api

var responsePromise = $http.post("api/tasks",$scope.task);
responsePromise.success(function(data, status, headers, config) {
    alert("Data created successfully");
});
responsePromise.error(function(data, status, headers, config) {
alert("Error")
});

If assigned member size is more than 175 when i send this json i got 404 error

If assigned member size is less than 175 when i send this json it will success

If i getting 404 error my browser console is like this Request header

Host: localhost

User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0

Accept: application/json, text/plain, /

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Content-Type: application/json;charset=utf-8

Referer: http://localhost/login.do

Content-Length: 24580

Response header

Connection: close

Content-Encoding: gzip

Content-Type: text/html

Date: Thu, 15 Dec 2016 14:21:56 GMT

Server: nginx/1.10.1

Transfer-Encoding: chunked

6
  • I think it depend on your server setting, not on Angular side. PHP for example, it have default POST size is 2 MB, please try to increase it Commented Dec 15, 2016 at 8:53
  • If you get 404 then that's what your server says. The browser doesn't make up status codes. Commented Dec 15, 2016 at 8:53
  • @Vo Kim Nguyen but I sended 12MB Image it working fine Commented Dec 15, 2016 at 9:01
  • @Sami Kuhmonen no error showing in my console Commented Dec 15, 2016 at 9:02
  • @Vo Kim Nguyen how to increase post size in jetty server Commented Dec 15, 2016 at 9:17

1 Answer 1

0

I don't know if it is really the same problem, but we have already encountered such case. We used Angular and Apache server. When we sent requests that exceeded 128 KB, we had an error. It has been found that the ModSecurity module of Apache tries to write / delete a temporary file to a directory where it does not have permissions. This error only occurred when the query data exceeded 128 KB because in Apache there is a SecRequestBodyInMemoryLimit parameter that was set to 128 KB by default. So we give the user who launches the apache process the permission to write and delete files in the /home/imtadmw/logsSSL/ directory. I hope this can guide you. Here are some useful links: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#SecTmpDir and https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#SecRequestBodyInMemoryLimit

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.