ERR_EMPTY_RESPONSE in Codeigniter

Viewed 1603

When I tried to access my website it shows an error lke

This Page Isn't Working

www.abcdef.com didn't send any data

ERR_EMPTY_RESPONSE

and showing this error for a few seconds it will redirect to original page.

In Google chrome console it showing following error

POST https://www.abcde.com/Is_here/1542792525 net::ERR_EMPTY_RESPONSE

net::ERR_EMPTY_RESPONSE
send @ jquery.js:9566
ajax @ jquery.js:9173
jQuery.(anonymous function) @ jquery.js:9322
(anonymous) @ place:2255
setInterval (async)
(anonymous) @ place:2253

and the code in which error occurs is

setInterval(function(){ 
var c = "<?= TIME() ?>";
  $.post("<?= base_url() ?>Is_here/"+c,{a:"<?= $this->uri->segment(4) ?>",b:c,e:"<?= $this->uri->segment(5) ?>"},function(l_i){
     
    });
   },10000);

2 Answers

err_empty_response was not the error from framework or website script.

Clear the cache from your browser or reset your browser then restart your server.

Chrome do not allows cross domain AJAX, that's why i think your request is not classed as a simple request under the cross-origin request specification: https://www.w3.org/TR/cors/#simple-cross-origin-request-0.

You can control this via HTTP header by adding Access-Control-Allow-Origin. Setting it to * will accept cross-domain AJAX requests from any domain.

Using PHP, just add the following line into the script that you want to have access outside from your domain:

header("Access-Control-Allow-Origin: *");

and enable mod_headers module in httpd.conf.

Related