Is it possible to make specific worker services accessible only through service bindings?

Hi 👋 ! Is it possible to make specific worker services accessible only through service bindings?
4 Replies
James
James•2y ago
I believe you can do workers_dev = false and assign zero routes to it, and then it's inaccessible outside of a service binding
Muhymin
MuhyminOP•2y ago
But if the worker is not assigned any routes, then how can I access it using a service binding?? Could you please give a code example for connecting to a service binding @cherryjimbo ?? When sending a request to the connected worker, isn't the URL of the request important??
James
James•2y ago
It's not, no. The routes just define where it's "listening" and responding to. If there's no routes, it doesn't matter. You could hit http://some-unknown-host/some-path and your worker would still get it when you use env.SERVICE.fetch('http://some-unknown-host/some-path') for example
Muhymin
MuhyminOP•2y ago
Okay, I understand. Thanks for your help @cherryjimbo !
Want results from more Discord servers?
Add your server