How to call a Worker from another Worker (403)
Inside of a Worker - how do you call another Worker without Cloudflare challenging the request?
E.g.
I've tried adding a bunch of headers into the Fetch - but still get the 403.
Is there a way to tell Cloudflare to trust its own IPs?
4 Replies
Do you mean RPC?
it doesn't have to be, can just be the fetch handler: https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/
Cloudflare Docs
Service bindings - Runtime APIs · Cloudflare Workers docs
Facilitate Worker-to-Worker communication.
Service Bindings are a smart idea to use anyway if you have control over both workers as they run in same isolate/no network
If two workers execute on the same zone (ex: workers.dev is a zone, anything under websites is a zone), they'll never be able to call each other,
cookies.me.workers.dev -> cookies2.me.workers.dev = no
worker1.cookies.dev -> worker2.cookies.dev = no
worker1.cookies.dev-> cookies2.me.workers.dev = yes
Thanks!