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. Add your own domains once they're claimed.
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. - SPAs can set
override_404 = "/index.html"to serve the app for unknown paths.
CLI HCL reference: service.