I'm making a service just like "uptime"
I'm making a service just like "uptime" and I want to test the website from multiple location, I want to use proxy, so I can test it from Europe/Asia/US etc, is the
cf
is something we can edit and tell it where it executes the request from? o010 Replies
cf
tells you where the call came from but not where it should come from. For that you need to use "Location Hints" (for Durable Objects). https://developers.cloudflare.com/durable-objects/reference/data-location/#provide-a-location-hintCloudflare Docs
Data location
Jurisdictions are used to create Durable Objects that only run and store data within a region to comply with local regulations such as the GDPR or FedRAMP.
That said, I now understand the goal of using the proxy and can guess at your architecture. Tell me if this is correct. Your new "uptime.com" alternative is hosted in Cloudflare using Workers and Durable Objects. Your customers will input a website that they want you to track the uptime of and possibly other things like latency. You want to be able to report this information based upon where in the world your customer's users might be.
You want to use a proxy to simulate hitting your cutomer's website from anywhere in the world.
So far so good?
I want the user to be able to pick a location where the test is performed from, so he could test it from 10 locations
So, you could use the Location Hint capability of DOs and run the tests from those locations with a DO specifically designed to do that testing.
That said, if you need it more fine-grained than Cloudflare's rather coarse-grained locations or if you are unhappy with the "best effort" caveat, I can see how a proxy might be advantageous. You'll have to figure out how to subtract out the latency between where you generate the traffic and the proxy from the latency between the proxy and your customer's website... if latency is something you want to test for.
As for your original question about best practices, I don't think there is anything special to worry about. Just hit the API of whatever proxy you decide to use from your Worker or DO code. The biggest complexity is in figuring out how to use the API of your proxy service.
For this use case you really should use static IPs so your users can avoid blocking them
Also unfortunately there are some platforms (Siteground, Hostinger, Shopify, etc) that outright block CF IPs so doing uptime monitoring from CF is not reliable
Personally I would set up a few cheap servers with digitalocean to proxy the requests and use floating IPs so they are fixed. This is what we do when we need a static IP and have a short node script to do the proxying
Yeah I'm looking to just use service such as Oxylabs, I'm guessing since wall time is not being charged, it won't matter.
Wall time is charged in DOs
... but not in Workers
Yeah, at the end requests are made through workers, not through DO, correct me if I am wrong
It's under your control. You can initiate a
fetch()
from either a DO or a plain Worker.