Something interesting that I just noticed, and which had me really scratching my head for longer than I care to admit… If you make a 2 or more GET requests to the same URL, subsequent requests will wait for the first request to return before processing.
I was testing a script that uses file locking on a high volume server to ensure that only one instance of an operation is being performed, i.e. only the first request performs the operation, and subsequent requests would not; instead, they return/exit immediately.
What I observed is that, when I introduced a “sleep” on the first request – for debug purposes – and then made a separate concurrent request to the exact same URL, the second request would wait until the sleep in the first request was finished before returning a result. But, that subsequent request should have return data immediately because it did not run the operation (which includes the sleep).
After scratching my head looking at the code for a while, it finally dawned on me that it must be something Cloudflare-related. I was able to confirm this by changing the URL of the second request, which is canonical and resolves to the same script and runs the same code. In this case, the second request processed correctly and returned a result before the first request finished sleeping. Thus, the problem is related to concurrent requests to the same identical URL, rather than my code (which doesn’t use the URL as part of the logic).
I originally though that this might be related to caching enabled, however the I get the same results even with caching set to “Bypass” for the entire subdomain.
I can sort of see why something like this might be implemented as an “optimization” but, to be honest, I perceive this as more of a bug.