Fetch origin using worker endless loop
I'm trying to do something using a worker on a route before passing the request on (to cache, origin, etc.). I think I should be able to just call
Can someone hit me on the head real quick? :NotLikeThis:
fetch()
on the original request
, but that puts me in an endless loop of the worker calling itself.Can someone hit me on the head real quick? :NotLikeThis:
12 Replies
Is your worker setup as a worker route through Websites -> your.domain -> Worker routes?
Also did you confirm that the request.url is the one that you expect it to be? This won't work I think on something like the
.workers.dev
domains.Yes, it's setup like that
request.url is what I expect
you can see it looping in the console
Is your origin hosted on cloudflare?
proxied, and html cached on cloudflare
maybe for more context, my original question: https://stackoverflow.com/questions/78852509/run-cloudflare-workers-while-maintaining-cached-html-delivery/78853634
Stack Overflow
Run Cloudflare Workers while maintaining cached HTML delivery
I'm caching HTML content on Cloudflare and would like to replace client-side pixel tracking with pure server-side tracking - without any client-side initiation. I would like to use Cloudflare Worke...
What might be interesting to run is to go to your cloudflare account dashboard and go to Trace (beta), maybe that might reveal something interesting!
No much help sadly
yep
just figured it out lol
autocomplete got me haha
fet
+ enter does this.fetch()
:lul:OOhhhhh hahaha, ofc 🤯