Services

last updated: 2025-10-04

Services are containers that are triggered by an HTTP endpoint. Examples of services include:

  • Websites
  • APIs
  • Webhooks

For these endpoints, we use our scale-to-zero technology to shut down unused resources and initialize them only when a request comes in.

How it Works

When you create a service, we create a public endpoint and issue a valid TLS certificate for it. By default, this endpoint hosts an empty HTTP server that you can use to test your setup.

When you provide us with a container image, we replace our static placeholder with your website or API.

Container Image Requirements

Each container image is initialized on demand, so any system deployed to DownToZero (DTZ) needs to be designed with this in mind.

By default, DTZ waits for the container to open any port. The first port that is opened is gonna be the one, that DTZ attaches on and forwards the request to.

Environment Variables

The runtime provides the following environment variables to your service:

variable settable description
PORT yes The port your application should listen on.
DTZ_ACCESS_TOKEN yes (identity can be changed) A JWT generated from the context that allows resources to be accessed within the context.
DTZ_CONTEXT_ID no The DTZ context that the current application is running in.

HTTP Request Headers

The runtime injects the following HTTP headers into every request forwarded to your service:

header example value description
X-Request-ID 5f2a9b4e-2e9e-4e6c-a2a3-9f2a1c3d4e5f Unique identifier for the request. Useful for correlating logs and tracing across components.
X-Forwarded-Host api.example.com The original Host value the client requested. Use when generating absolute URLs or for multi-tenant routing.
X-Forwarded-Proto https The original protocol used by the client. For public endpoints on DTZ this is always https.

These headers are provided by the platform and reflect the client-facing request context; your application should treat them as read-only inputs.