Skip to main content

Routing & Middlewares

All inbound traffic to your apps flows through Goma Gateway. Miabi configures Goma for you from the domains and apps you define — you describe what should be reachable, and Miabi generates the routing.

Routing and middlewares

How routing works

When you attach a verified domain to an application, Miabi writes a route file into Goma's watched file-provider directory (MIABI_GOMA_PROVIDER_DIR, default /etc/goma/providers) that maps the hostname to the app's container on the internal network. Goma's file provider continuously watches that directory and hot-reloads the routes; it handles TLS termination (see TLS certificates) and forwards the request to the right container.

Miabi drives Goma purely through that directory — there is no API endpoint or auth token between the two. Miabi writes YAML; Goma watches and reloads it. The gateway's own goma.yml supports ${VAR} environment-variable substitution (hosts, ACME email, Redis password, …), so a single .env configures both Miabi and the gateway. See Configuration.

Because everything goes through Goma, app and database ports are never published on the host. The only public surface is the gateway itself.

The proxy abstraction

Goma sits behind a pluggable proxy abstraction. Miabi talks to a generic reverse-proxy interface, and Goma is the default implementation. This keeps the door open for other proxies later without changing how you define domains, routes, or middlewares. See the architecture overview for where the abstraction sits in the system.

Workspace middlewares

Workspaces own middlewares — reusable request-processing rules you attach to routes. Common examples:

  • Authentication — require a login or token before traffic reaches the app.
  • Rate limiting — cap requests per client to protect a backend.
  • Headers — add, rewrite, or strip request/response headers (CORS, security headers, etc.).

Define a middleware once in the workspace, then attach it to one or more routes. Updating the middleware updates every route that uses it.

tip

Stack middlewares to compose behavior — for example, rate limiting and an auth check on the same route. They run in order on each request.

Edge gateways

Goma also provides a per-node edge gateway. In a multi-node deployment each node runs its own Goma instance handling traffic for the apps scheduled on it, while routing and middleware definitions remain workspace-level. See Nodes for how work is distributed across nodes.

note

Routes are generated from your domains and apps — you don't hand-edit Goma config. Manage behavior through domains, app settings, and workspace middlewares.