Unisrv logoUnisrv.io
Service Primitives

Services

HTTPS entrypoints that route hosts and paths to deployments.

A service is how HTTP traffic from the internet reaches your deployments. The Unisrv edge terminates TLS, then routes each request by path prefix to a deployment or proxies it to an external URL.

A request for /api/users arrives at a service over HTTPS. The service checks its locations in order: /api/admin does not match, /api does, so the request goes to the api deployment and the remaining locations are never checked.

Every service gets {service}-{slug}.unisrv.dev for free, where the slug comes from its environment.

Custom domains

  1. Claim the domain with unisrv host claim or from Hosts in the web console. Both show the DNS records to create.
  2. Create the records at your DNS provider. Unisrv issues a Let's Encrypt certificate once they resolve.
  3. Add the domain to the service's hosts.

Names under unisrv.dev need no DNS. unisrv up claims them for you.

Things to know

  • HTTP only, for now. Services are L7. Raw TCP and UDP need a dedicated IP per service, which isn't supported yet. For traffic between deployments, use an internal network.
  • HTTPS by default. Plain HTTP redirects unless you set allow_http.
  • Unreachable instances are skipped. If the edge can't connect to an instance, it sends the request to another one. A request the instance may already have received is only retried when its method is idempotent, such as GET.
  • SPAs can set override_404 = "/index.html" to serve the app for unknown paths.

CLI HCL reference: service.

On this page