Bindings
service
Calls from one service to another, inside Zeroko.
json
"bindings": { "API": "service:api" }js
const res = await env.API.fetch("https://api/orders?id=7", { method: "POST", body })The request reaches that service as one to its address would; only the path and query of the URL count. It never leaves Zeroko: no egress rules apply and nothing goes over the internet. HTTP only: realtime connections come from clients.
Who is calling
The request arrives with X-Zeroko-From: <caller>. Zeroko removes that
header from every request from outside, so a service can keep routes for the
services that call it:
js
if (url.pathname.startsWith("/internal/") && request.headers.get("X-Zeroko-From") !== "web")
return new Response("Forbidden", { status: 403 })The call shows in that service's logs and metrics.
A request goes through up to 16 services in a row this way. Past that,
the call answers 508: the services are calling each other in a cycle.