I have a long-lasting PHP script running on server. It streams video to
video tag from server (don’t ask me why I do it 🙂 ). It can run for tens of minutes.
The problem is that at the same time I want to send the request to server using AJAX and it doesn’t happen before the long script stops.
I’ve investigated the issue a bit more and I found out strange things.
- While the long-lasting PHP script is running I can not call any PHP scripts (either AJAX or not) from the same browser.
- Meanwhile from other browser server is accessible without problem.
- Non-php assets (images, videos) can be accessed without problems.
- In case video is played directly from .mp4 file the problem doesn’t exist. AJAX requests to php can be processed while video is played.
I’m curious what could cause this issue. From what I see it could be combination of server and browser configuration.
My question is why it happens and how can it be solved? I want to be able do the AJAX requests to the server while other PHP script is running in the same browser.
Web server is Apache 2. It was reproduced in IE and Chrome.
Ajax request is sent using just normal jQuery’s $.ajax() call.
Here is the request and response information for the video request that blocks AJAX request.
Request GET /portal/portlet/index/id/671/call/proxyVideo?entityId=1 HTTP/1.1
If-Unmodified-Since Fri, 24 Apr 2015 08:18:29 GMT
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding gzip, deflate
Response HTTP/1.1 206 Partial Content
Date Tue, 01 Dec 2015 13:39:31 GMT
Server Apache/2.4.16 (Unix) PHP/5.6.13
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Last-Modified Fri, 24 Apr 2015 08:18:29 GMT
Content-Range bytes 360448-261207372/261207373
Keep-Alive timeout=5, max=100