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

6 messages · Page 1 of 1 (latest)

limpid mist
#

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

crisp spire
#

I believe you can do workers_dev = false and assign zero routes to it, and then it's inaccessible outside of a service binding

limpid mist
#

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 @crisp spire ??

#

When sending a request to the connected worker, isn't the URL of the request important??

crisp spire
#

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