Inside my app, I use $http post requests because on server side all PHP services accept only post request. PHP web services are located in godaddy.
After some consecutive $http post requests(usually after 10-20 request), I start to get ERR_EMPTY_RESPONSE from server. I did some research and found that this is because a security issue from server to prevent attacks. Apache server's mod_sec setting causes this problem but I don't have permissions to override it.
I decided to test, if this issue is specifically caused by POST requests. so I wrote a simple PHP file and AngularJS test script. If I use GET request I don't get any ERR_EMPTY_RESPONSE errors. Are there any $http POST settings on client side AngularJS or any Apache server setting which I can place in .htaccess file, so server doesn't block POST requests?
PHP script:
<?php
echo json_encode(array("item"=>"dummy test service."));
?>
AngularJS script:
var success_count = 0;
var method = 'GET'; //try 'POST' and you will get ERR_EMPTY_RESPONSE
stop = $interval(function() {
$http({
method : method,
url : 'test.php'
}).then(function successCallback(response) {
console.log(success_count);
success_count++;
}, function errorCallback(response) {
console.log("error after "+success_count+" successful request.");
success_count = 0;
});
}, 200);