[sorry for bad english]
I just started checking out workers and it’s amazing. It makes me sad that I discovered it so late. Also, I am a beginner generally speaking and I stumbled upon workers a few days back and I don’t know how to explain what I want to achieve.
I want to ask is there any way to only “observe” a request?
Say, I have a 3rd party service at www.MyDomainWithCloudFlare.com/someApi
What I understood so far is:
if I assign a worker to the route - www.MyDomainWithCloudFlare.com/someApi, whenenver this api is called, the worker will be invoked and I shall write the code to take care of request and response modification.
mostly, I just want to observe what is the request, and what is the response, and take action only in some cases. E.g. whenever www.MyDomainWithCloudFlare.com/someApi is called make changes if it is from one particular country, or if the response is empty. for rest of the cases - usual behavior shall follow(behavior as if worker isn’t deployed). Do I have to handle all the request that comes to the worker or only these that I want to modify. Is there any way to say do what would have been done if the worker weren’t present?
if I have to handle all requests, my worker gets invoked when www.MyDomainWithCloudFlare.com/someApi is fetched by the browser. And inside the worker I’ll make a fetch to “www.MyDomainWithCloudFlare.com/someApi”, will this become a loop?