I want to run a worker only for GET requests from US visitors. Will the following code work? The actual async function (not included here) doesn’t have any reference to country or headers. I have enabled “IP geolocation” in the network tab.
What exactly do you mean? Do you just not want to run a certain part of your worker for visitors from the US or avoid the entire worker from being run? In the latter case, that would not be possible. At this point the worker will have already started running. Currently it is not possible to selectively run a worker.