I studied the documentation about the fetch api call
to find a answer to my question about possible unwanted recursive loop calls when using fetch inside workers but somehow the documentation does not answer my question.
If i have the following route for my test worker script
and inside of my worker i call fetch() with the following url argument as a failover because let’s say the static content was not found inside the kv DB and for this a fetch to the original server with the same url needs to be maked.
response = fetch('https://www.mydomain.com/static/pagexyz.html')
will this cause a new call to my worker script as it makes a new request that match the defined route .mydomain.com/static for the test worker script or will the fetch call inside the worker make a direct call to the origin server ignoring the route ?
I could not find anywhere any Answer.
I ask this becouse when i debug such a test case inside the worker Editor
the fetch api call inside the test worker returns always a 200 response even when the url point to a 404 non existent resource on the original server !
This is very Strange and should not happen and i ask me why fetch returns 200 OK even the resource does not exist on the original server !
I guess this indicate that fetch indeed inside a worker script makes recursive loop calls to the defined route but then how can the orginal resource be fetched from inside the worker script ?
Thanks in advance for any helpfull answers !