Problem With Keep-Alive on Apple Devices

Hi,


I'm a developer and in my phonegap application I have an ajax request that gets called once every 5 seconds.
These requests work correctly on android devices and also on windows (through the browser) computers.
However testing on apple devices (iphone 6s running ios 11.1.1 and macbook white running macos sierra) only the first request works, the second one returns readystate = 0.
After debugging I verified that the problem happens because the keep-alive timeout of the request response header is equal to my request interval, that is, every 5 seconds I make a request and my server's keep-alive timeout was also set to 5 seconds.
Below are details of my environment:
Server: Apache 2.0 - PHP Version 7.1.11 - Ubuntu 16.04 LTS
Server configuration: KeepAlive On; KeepAliveTimeout 5

Sample code:


HTML and JS: Edit fiddle - JSFiddle


PHP (teste.php):

// header("Connection: close"); // to solve the problem, just uncomment this line

echo json_encode(["asd" => 1]);


iPhone 6s, iOS 11.1, The same problem occurs on MacOS

Posted on Nov 16, 2017 9:04 AM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Problem With Keep-Alive on Apple Devices

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.