I receive no data from server after multiple POST requests

落爺英雄遲暮 提交于 2019-12-23 03:07:57

问题


I've been struggling with a problem where multiple POST requests seemingly crash the server (site won't load, no requests allowed) for a couple minutes. GET requests do not cause this issue.

This isn't a code issue, the code works fine

It's likely something with my server config.

Example of Frontend JS:

$(".searchbox").keyup(function() {
  var data = $('.searchbox').val();
      $.ajax({
        url: "../assets/php/graphenesearch.php",
        method: "POST",
        data: {
          data: data
        },
        async: true,
        dataType: "html"
      }).done(function(msg) {
        $(".search-output").html(msg);
      });
});

Example of Backend PHP:

$input = $_POST['data'];

echo $input;

Even with this simple of code, I'm having issues. So it's clearly with the number of requests and not the amount of data being passed.

The server allows ~40 requests, but then stops functioning.

I receive this error:

POST http://www.graphenesearch.co/assets/php/graphenesearch.php net::ERR_EMPTY_RESPONSE

It's probably something obvious right? Server config?


回答1:


Giving you a detailed answer if there is any problem with request handling in server side there will be several problems

  1. Server Network ( You don't have any problem with you code , sometime some data center face internet connection problem . DDOS attacks on data center can also cause damage on processing request )

  2. Getting too much request ( Every web server have some limitation because on server can not handle too much request . In Low quality shared hosting or Low quality OpenCV hosting you'll face this kind of problem . Even I faced this kind of a problem)

  3. PHP Configuration error , you'r php might not configured correctly . maybe that is causing all damage . Open the php log file to check there. after configuration fix PLEASE RESTART YOUR SERVER.



来源:https://stackoverflow.com/questions/34986709/i-receive-no-data-from-server-after-multiple-post-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!