I am proxying a fetch request to my users, making the worker act as a proxy. Checking the headers of the request seems to give seemingly random locations for where this is proxied from. I require the worker to be extremely close to the user.
For example:
- Request from user located in MCI location
- First test responds from CDG
- Second test responds from MAD
- Third test responds from DFW
- Fourth test responds from IAD.
- Fifth test responds from MIA.
- Sixth test responds from CDG again. Why, this is in Paris, France, the file is in Frankfurt Germany, and the user is in MCI...
This leads to very slow download speeds and slower than expected TTFB, which is not acceptable.
Is CF-Ray accurate for workers? This article says it is: https://developers.cloudflare.com/fundamentals/reference/http-headers/#cf-ray
The Cf-Ray header identifies the data center processing the request when displayed as a response header. This is represented by a three-letter code corresponding to the data center's location.
I did some research and apparently workers runs in every datacenter location, so I am not sure why a user located nearest to MCI is not served the proxied file from MCI. Is there a way to fix this?
I am on the paid workers plan, and the domain is on a Cloudflare Business plan, which should give me priority. I have not enabled smart placement, as I require the datacenter serving the request to be nearest the user, not the source.
It should also be noted the files come from the EU/US with direct PNI to Cloudflare, so it's not the upstream being slow. We also do the same with BunnyCDN and their Edgescripting and it works fine with a similar approach.