2 <h2>What is a Dangling Server</h2>
4 Sometimes we need to make sure on one single web page, two AJAX requests hit
5 servers that are running with the same version of PHP code. This isn't always
6 the case during push time. Dangling server is trying to solve this problem by
7 running old instance of server on a different port for longer time before
8 shutting down. This way, on new server, if a page detects that the page needs
9 to be served from old version, it can simply call:
11 if (dangling_server_proxy_old_request()) {
14 // otherwise continue executing the page with new version
16 What dangling_server_proxy_old_request() will do is to send an HTTP request to
17 the local dangling server with URL, headers and POST data of current request,
18 and update current response's headers and output buffer with what it gets. It
19 will return false, if it failed to contact the dangling server that may have
22 Similarly, an old server can call dangling_server_proxy_new_request(), if it
23 knows which servers will surely get new version of the software first:
25 if (dangling_server_proxy_new_request($host)) {
28 // otherwise, do something about it