I have built a worker which caches the response of this API. If the data is not in the cache, the worker fetches the response from the origin server on GCP.
response = fetch(request)
when I fetch the response from the browser by hitting https://api.example.com I get an error because of recursion. It seems instead of calling global fetch, local fetch is being called.
My notion is that this fetch inside the worker will resolve to CNAME value but it calls itself.
I am using “wrangler”: “2.9.1” and routing to intercept requests.
It was getting redirected from the origin server. It seems when a request goes through the worker, if SSL is not enabled for the website on the Cloudflare dashboard, the worker won’t add a certificate with the request. My server was configured to redirect requests which are not secure.