---
title: Self-hosting the web UI
description: Run the observability web UI next to a self-hosted World, and protect it with a JWT from your proxy or an OpenID Connect sign-in.
docs_index: /llms.txt
lastUpdated: 2026-12-01
type: guide
summary: "Deploy @workflow/web as a server or an embedded handler and configure its authentication."
related:
  - /docs/observability
  - /docs/configuration/cli-and-web-ui
  - /worlds/postgres
---

> For an index of all documentation, see [/llms.txt](/llms.txt).

The [observability](/docs/observability) web UI ships as `@workflow/web`. With a self-hosted World, you run it yourself: a server process that reads the same storage as your application through its World, and serves the UI to browsers.

Anyone the UI lets in can read every run, including inputs and outputs, and can cancel, recreate, re-enqueue and wake runs and resume hooks unless it is read-only. Every user acts with the server's own World credentials.

For the Postgres World and its Helm chart, see [Postgres World and Kubernetes](#postgres-world-and-kubernetes) at the end of this page.

## Who can reach it

Without configuration, the UI serves **loopback clients only**. The client's socket address must be loopback, and the `Host` header must name `localhost`, a `*.localhost` name, `127.0.0.1` or `[::1]`. A browser on the same machine and port forwarding into it (an SSH tunnel, `kubectl port-forward`) work; any other client gets a `403`.

In a container, a published port reaches the server from the container network's gateway address, not from loopback, so `docker run -p 3456:3456` answers `403` too; forward a port into the container, or configure authentication.

When embedded via `createWorkflowWebHandler()` in a host server that does not expose the client's socket address on the `Request` (srvx-based hosts such as Nitro v3 do; Nitro v2's `fromWebHandler` does not), the default loopback check falls back to the `Host` header alone. Configure `WORKFLOW_WEB_AUTH` (or `auth`) for any embedded UI reachable from other machines.

To serve other clients, set `WORKFLOW_WEB_AUTH`:

| Value  | Use it when                                                                                                                   |
| ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `jwt`  | A reverse proxy, or another application's server, sits in front of the UI and attaches its own signed token to every request. |
| `oidc` | People open the UI directly and sign in with your identity provider.                                                          |
| `none` | The UI sits behind access control of its own, such as a VPN or an authenticating proxy. Anyone who reaches it is let in.      |

The server refuses to start when the configuration is incomplete or invalid: an auth variable without `WORKFLOW_WEB_AUTH`, a missing required setting, a malformed value, or, in `oidc` mode, a discovery document that can't be read or names another issuer.

## Running the server

The UI needs `@workflow/web` and your World's package installed in the same project, `WORKFLOW_TARGET_WORLD` naming that package, and the World's own environment variables:

```bash
npm i @workflow/web <your World package>

WORKFLOW_TARGET_WORLD=<your World package> \
PORT=3456 \
node node_modules/@workflow/web/server.js
```

The UI's process creates its own World instance. Configure it so that it doesn't run workers of its own, if your World has them, and so that the runs the UI wakes up or re-enqueues reach your application's workers.

These settings apply to the server whichever way it is reached:

| Variable                     | Default                      | Meaning                                                                                                                                                                                                                      |
| ---------------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `WORKFLOW_WEB_AUTH`          | unset: loopback clients only | `jwt`, `oidc` or `none`                                                                                                                                                                                                      |
| `WORKFLOW_WEB_READ_ONLY`     | `false`                      | `true` or `1`: refuse cancel, bulk cancel, recreate, re-enqueue, wake up and resume hook, and reading hook tokens, with a `403`, and leave hook tokens out of hooks and events. The buttons stay visible and show the error. |
| `WORKFLOW_WEB_ALLOWED_HOSTS` | none                         | Host names the UI is reached by, comma-separated, besides loopback names and IP addresses. `.example.com` matches the domain and its subdomains. Cross-origin `POST`s are refused unless their origin is listed.             |
| `WORKFLOW_WEB_BASENAME`      | `/`                          | Path to serve the UI under, such as `/workflows`                                                                                                                                                                             |
| `PORT`                       | `3000`                       | Port to listen on                                                                                                                                                                                                            |

In your own server, `createWorkflowWebHandler()` from `@workflow/web/handler` serves the same UI as a `Request` to `Response` handler under a `basename`. It takes `allowedHosts`, `readOnly`, `auth` and `world`. `auth` takes every setting below in camelCase (`issuer`, `jwksUrl`, `allowedEmails`, ...) and replaces the variables. `world` is your application's World instance, or a function returning one, for a World that environment variables can't configure, such as one whose credentials rotate; every dashboard in a process shares it.

## JWT from a proxy

In `jwt` mode, every request must carry a JWT that verifies against your JWKS, with the configured issuer and one of the configured audiences, an `exp` claim, and an asymmetric signature.

| Variable                            | Default                          | Meaning                                                                                                                                                            |
| ----------------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `WORKFLOW_WEB_AUTH_ISSUER`          | required                         | Expected `iss`                                                                                                                                                     |
| `WORKFLOW_WEB_AUTH_AUDIENCE`        | required                         | Accepted `aud` values, comma-separated                                                                                                                             |
| `WORKFLOW_WEB_AUTH_JWKS_URL`        | required                         | The issuer's public keys; `https`, or `http` on localhost. Keys are cached, and fetched again when a token names an unknown key ID, so the issuer can rotate them. |
| `WORKFLOW_WEB_AUTH_ALGORITHMS`      | RS, PS and ES 256/384/512, EdDSA | Accepted algorithms. `HS*` and `none` are refused.                                                                                                                 |
| `WORKFLOW_WEB_AUTH_CLOCK_TOLERANCE` | `5`                              | Seconds of clock skew accepted, from 0 to 300                                                                                                                      |
| `WORKFLOW_WEB_AUTH_TOKEN_HEADER`    | `authorization`                  | Header that carries the token, as `Bearer <token>`. A custom header may carry the bare token.                                                                      |
| `WORKFLOW_WEB_AUTH_TOKEN_COOKIE`    | none                             | Cookie that carries the token when the header is absent. A write authenticated by a cookie must come from the same origin.                                         |

The [allowlists](#allowlists-and-read-only-access) restrict which tokens get in.

### Proxying the UI

The UI's browser code calls `<basename>/api/rpc` and `<basename>/api/stream/:id` on the origin it was loaded from. A proxy has to forward every path under the basename, without rewriting it, and attach the token to each request:

- Serve the UI under the same basename the proxy forwards, with `WORKFLOW_WEB_BASENAME`.
- Replace any `Authorization` header and drop cookies from the browser.
- Authenticate and authorize the user in the proxy first. The UI trusts every request that carries the proxy's token.
- Forward the browser's `Origin`, and list the proxy's host name in `WORKFLOW_WEB_ALLOWED_HOSTS` next to the UI's own, so the UI keeps refusing cross-origin writes.

For example, a Next.js app on a platform that issues OIDC tokens to its functions, such as [Vercel](https://vercel.com/docs/oidc), can serve the UI at `/workflows`:

```ts title="app/workflows/[[...path]]/route.ts"
import { getVercelOidcToken } from '@vercel/oidc';

// For example https://workflows-ui.example.com, the UI's own address.
const upstream = process.env.WORKFLOW_UI_URL!;

async function proxy(request: Request) {
  await requireAdmin(request); // your own check of the signed-in user

  const url = new URL(request.url);
  const headers = new Headers(request.headers);
  for (const name of ['host', 'cookie', 'authorization', 'accept-encoding']) {
    headers.delete(name);
  }
  headers.set('authorization', `Bearer ${await getVercelOidcToken()}`);

  const hasBody = request.method !== 'GET' && request.method !== 'HEAD';
  const response = await fetch(new URL(url.pathname + url.search, upstream), {
    method: request.method,
    headers,
    body: hasBody ? request.body : undefined,
    // @ts-expect-error: Node.js needs it to stream a request body.
    duplex: 'half',
    redirect: 'manual',
  });
  const out = new Headers(response.headers);
  out.delete('content-encoding');
  out.delete('content-length');
  return new Response(response.body, { status: response.status, headers: out });
}

export { proxy as GET, proxy as HEAD, proxy as POST };
```

The UI then verifies the platform's token. With Vercel's team issuer:

```bash
WORKFLOW_WEB_BASENAME=/workflows
WORKFLOW_WEB_ALLOWED_HOSTS=workflows-ui.example.com,admin.example.com
WORKFLOW_WEB_AUTH=jwt
WORKFLOW_WEB_AUTH_ISSUER=https://oidc.vercel.com/my-team
WORKFLOW_WEB_AUTH_AUDIENCE=https://vercel.com/my-team
WORKFLOW_WEB_AUTH_JWKS_URL=https://oidc.vercel.com/my-team/.well-known/jwks
WORKFLOW_WEB_AUTH_REQUIRED_CLAIMS='{"project_id":"prj_...","environment":["production"]}'
```

Every project of the team gets tokens with the same issuer and audience, so pin the proxy's project and environment with `WORKFLOW_WEB_AUTH_REQUIRED_CLAIMS` (or its exact `sub` with `WORKFLOW_WEB_AUTH_ALLOWED_SUBJECTS`). Where the platform can mint a token for an audience of your choosing, use one dedicated to the UI, so that a token sent to another service can't be replayed against it.

## OpenID Connect sign-in

In `oidc` mode, the UI signs people in with the authorization code flow and PKCE (S256), checks the ID token's signature, issuer, audience (the client ID), `nonce` and expiry, and keeps the sign-in in an encrypted, `HttpOnly`, `SameSite=Lax` session cookie. It serves three routes under the basename: `/_auth/login`, `/_auth/callback` and `/_auth/logout`. A page load without a session redirects to the provider and comes back to the same page; an API call without one gets a `401`.

Register `<public URL><basename>/_auth/callback` as a redirect URI with your provider.

| Variable                            | Default                                                   | Meaning                                                                                                                                                                        |
| ----------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `WORKFLOW_WEB_AUTH_ISSUER`          | required                                                  | The provider's issuer. It must equal the `issuer` in the discovery document.                                                                                                   |
| `WORKFLOW_WEB_AUTH_DISCOVERY_URL`   | `<issuer>/.well-known/openid-configuration`               | Discovery document                                                                                                                                                             |
| `WORKFLOW_WEB_AUTH_CLIENT_ID`       | required                                                  | OAuth client ID                                                                                                                                                                |
| `WORKFLOW_WEB_AUTH_CLIENT_SECRET`   | none                                                      | Client secret, sent with `client_secret_basic`, or `client_secret_post` when the provider supports only that. Without it, the UI is a public client that relies on PKCE.       |
| `WORKFLOW_WEB_AUTH_REDIRECT_URI`    | required                                                  | The registered callback URL. Its path must be `<basename>/_auth/callback`; `https`, or `http` on localhost.                                                                    |
| `WORKFLOW_WEB_AUTH_SCOPES`          | `openid email profile`                                    | Space- or comma-separated. `openid` is always requested. Add the scope your provider needs for a groups claim.                                                                 |
| `WORKFLOW_WEB_AUTH_SESSION_SECRET`  | required                                                  | At least 32 characters, for example from `openssl rand -base64 32`. To rotate, list the new secret first and the old one after it, comma-separated, until old sessions expire. |
| `WORKFLOW_WEB_AUTH_SESSION_MAX_AGE` | `28800` (8 hours)                                         | Seconds a sign-in lasts, from 60 to 2592000                                                                                                                                    |
| `WORKFLOW_WEB_AUTH_COOKIE_NAME`     | `__Host-workflow_web_session`                             | Session cookie name; `workflow_web_session` when cookies aren't `Secure`                                                                                                       |
| `WORKFLOW_WEB_AUTH_COOKIE_SECURE`   | `true`, unless the redirect URI is `http://localhost`     | Can't be `false` with an `https` redirect URI                                                                                                                                  |
| `WORKFLOW_WEB_AUTH_ALGORITHMS`      | the provider's, among RS, PS and ES 256/384/512 and EdDSA | Accepted ID token algorithms                                                                                                                                                   |
| `WORKFLOW_WEB_AUTH_CLOCK_TOLERANCE` | `5`                                                       | Seconds of clock skew accepted                                                                                                                                                 |

A session lasts its full age once issued: the provider is not asked again until it expires, so removing a user at the provider takes effect at their next sign-in. Changing the issuer, client ID, allowlists or `WORKFLOW_WEB_READ_ONLY`, or removing the session secret a cookie was sealed with, signs everyone out.

There is no sign-out button in the UI yet: visit `<basename>/_auth/logout` to clear the UI's session cookie (this signs out of the UI only, without calling your identity provider's logout endpoint). Once a session expires in an open tab, API calls return `401` until you reload the page to sign in again.

## Allowlists and read-only access

Both modes accept the same restrictions. Without any allowlist, every token or account that verifies is let in.

| Variable                             | Meaning                                                                                                               |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
| `WORKFLOW_WEB_AUTH_REQUIRED_CLAIMS`  | JSON object of claims that must each have one of the given values, such as `{"environment":["production","preview"]}` |
| `WORKFLOW_WEB_AUTH_ALLOWED_SUBJECTS` | Exact `sub` values allowed                                                                                            |
| `WORKFLOW_WEB_AUTH_ALLOWED_EMAILS`   | Email addresses allowed                                                                                               |
| `WORKFLOW_WEB_AUTH_ALLOWED_DOMAINS`  | Email domains allowed, such as `example.com`; subdomains are not included                                             |
| `WORKFLOW_WEB_AUTH_ALLOWED_GROUPS`   | Groups allowed                                                                                                        |
| `WORKFLOW_WEB_AUTH_GROUPS_CLAIM`     | The claim that lists groups. Default `groups`.                                                                        |
| `WORKFLOW_WEB_AUTH_WRITE_GROUPS`     | When set, only these groups can change runs and hooks; everyone else let in has read access                           |

Required claims must all match. With several allowlists, matching any one of them is enough. Emails and domains count only when the token has `email_verified: true`; for a provider that doesn't send it, use subjects or groups.

`WORKFLOW_WEB_READ_ONLY` gives everyone read access, whatever the allowlists say. With `createWorkflowWebHandler()` or `startServer()`, an `authorize(claims, { access })` function in `auth` has the last word: it returns `false` to refuse, `'read'` or `'write'` to set the access, or `true` to keep it.

In `jwt` and `oidc` modes, every write RPC action (cancel, recreate, re-enqueue, wake up, resume hook, fetch hook token) writes an audit line to stdout naming the caller by their `sub` claim, never their email address.

## Postgres World and Kubernetes

Everything above applies to the [Postgres World](/worlds/postgres). This section covers what is specific to it.

The Postgres World stores run data unencrypted (see [Data at rest](/worlds/postgres#data-at-rest)), so everyone the UI lets in reads it in the clear.

### Running the server

```bash
npm i @workflow/web @workflow/world-postgres

WORKFLOW_TARGET_WORLD=@workflow/world-postgres \
WORKFLOW_POSTGRES_URL=postgres://user:password@db:5432/app \
WORKFLOW_POSTGRES_JOB_PREFIX=billing_ \
WORKFLOW_POSTGRES_SKIP_WORKERS=1 \
PORT=3456 \
node node_modules/@workflow/web/server.js
```

- [`WORKFLOW_POSTGRES_SKIP_WORKERS=1`](/worlds/postgres#workflow_postgres_skip_workers) keeps the UI's process from claiming work; your application's processes run it.
- Use the same [`WORKFLOW_POSTGRES_JOB_PREFIX`](/worlds/postgres#workflow_postgres_job_prefix) as your application, so the runs the UI wakes up or re-enqueues reach its workers.
- The UI's process needs no [`WORKFLOW_POSTGRES_DEPLOYMENT_ID`](/worlds/postgres#workflow_postgres_deployment_id): a run it recreates keeps the deployment ID of the run it copies.
- To mount the UI in your application instead, pass your World to `createWorkflowWebHandler({ world })`, for example when its pool authenticates with rotating credentials that `WORKFLOW_POSTGRES_URL` can't express.

### Helm chart

The Postgres World's Helm chart runs the UI as an optional Deployment and Service, `<serviceName>-web`, next to your application. By default it runs your application's image with `node node_modules/@workflow/web/server.js`, so add `@workflow/web` to your application's dependencies, or set `web.image` to an image of its own. It gets the release's `env` and `envFrom`, the job prefix and `WORKFLOW_POSTGRES_SKIP_WORKERS=1`, and then its own `web.env` and `web.envFrom`. Its `web.allowedHosts` and `web.basename` set `WORKFLOW_WEB_ALLOWED_HOSTS` and `WORKFLOW_WEB_BASENAME`.

```yaml title="values.yaml"
web:
  enabled: true
  allowedHosts: [workflows.example.com]
  env:
    WORKFLOW_WEB_AUTH: oidc
    WORKFLOW_WEB_AUTH_ISSUER: https://login.example.com
    WORKFLOW_WEB_AUTH_REDIRECT_URI: https://workflows.example.com/_auth/callback
    WORKFLOW_WEB_AUTH_ALLOWED_DOMAINS: example.com
    WORKFLOW_WEB_AUTH_WRITE_GROUPS: workflow-admins
  envFrom:
    # WORKFLOW_WEB_AUTH_CLIENT_ID, WORKFLOW_WEB_AUTH_CLIENT_SECRET and
    # WORKFLOW_WEB_AUTH_SESSION_SECRET
    - secretRef: { name: workflow-web-auth }
```

```yaml title="ingress.yaml"
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: workflows-ui
spec:
  tls:
    - hosts: [workflows.example.com]
      secretName: workflows-example-com
  rules:
    - host: workflows.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: billing-web
                port: { name: http }
```

Without `WORKFLOW_WEB_AUTH`, the Deployment serves only `kubectl port-forward`:

```bash
kubectl port-forward deployment/billing-web 3456
# then open http://localhost:3456
```

Outside the chart, the UI is one container with the same command and variables. Give it a TCP probe: every HTTP path answers `401` once authentication is configured.

---

For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md)

For an index of all available documentation, see [/llms.txt](/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/agents.md](/agents.md)