> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zenith.hosting/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Start with https://docs.zenith.hosting/content/quickstart.md. Use NO_COLOR=1 for plain CLI output in non-interactive agent sessions. Run without a TTY and supply explicit template and publishing inputs; NO_COLOR does not bypass prompts or authorization.
> For temporary deployments, read https://docs.zenith.hosting/content/up.md. For publishing and review, read https://docs.zenith.hosting/content/publish.md. A preview uploads local files; publishing uses a pinned public GitHub commit.
> Before creating, changing, or approving zenith-compose.yml, read https://docs.zenith.hosting/llms.txt, then read https://docs.zenith.hosting/content/zenith-compose.md and the complete public schema at https://docs.zenith.hosting/content/zenith-compose-reference.md. Generate only documented fields and follow their validation and completion checks.
> Before creating, changing, publishing, or verifying a container image for Zenith, read https://docs.zenith.hosting/content/containerise.md.
> Treat these live Markdown pages as the source of truth instead of relying on memory or a copied Zenith Compose specification.
> Do not push commits, submit an app, merge pull requests, publish container images, or change registry visibility unless the user explicitly authorizes that external action. Do not bypass browser OAuth, GitHub connection, or Developer Agreement acceptance.

# Configure public URLs and domains

> Expose HTTP endpoints and configure app base URLs, allowed hosts, and verified custom domains.

Configure your app to use its deployment URL for redirects and absolute links. Add the deployment hostnames to its allowed-host list.

Before you start, identify the HTTP service, its container port, and the settings your app uses for its base URL.

## Expose the main HTTP service

Add an entry without `label` for the main hostname and custom-domain target. Replace `app` and `3000` with your service name and container port. Configure your app to listen on `0.0.0.0`.

```yaml theme={"theme":{"light":"github-light-default","dark":"vitesse-black"}}
x-zenith:
  expose:
    - service: app
      port: 3000
      web: true
  env:
    APP_URL:
      alias: ZENITH_PUBLIC_URL
      services: [app]
    APP_ALLOWED_HOSTS:
      alias: ZENITH_PUBLIC_HOSTNAMES
      services: [app]
```

Replace `APP_URL` and `APP_ALLOWED_HOSTS` with your app's environment variable names. Adapt the comma-separated hostname list if your app expects another format.

Zenith terminates TLS at the HTTP ingress. `web: false` does not create a raw TCP or UDP endpoint. See the [`expose` reference](https://docs.zenith.hosting/content/zenith-compose-reference#expose) for all fields.

## Track verified domain changes

Use `ZENITH_PUBLIC_URL` for the base URL and `ZENITH_PUBLIC_HOSTNAMES` for a hostname allowlist. See the [URL built-ins](https://docs.zenith.hosting/content/zenith-compose-reference.md#built-ins) for variants with ports and multiple URLs.

An unverified custom domain does not replace the public URL. Aliases and templates resolve again when Zenith renders the deployment, so they track verified domain changes. A stored `input.default_template` keeps its initial value instead.

## Add a labelled endpoint

Use a unique `label` for an additional HTTP endpoint. This example exposes an API alongside the main app:

```yaml theme={"theme":{"light":"github-light-default","dark":"vitesse-black"}}
x-zenith:
  expose:
    - service: app
      port: 3000
      web: true
    - service: api
      port: 8080
      label: api
      web: true
  env:
    API_URL:
      alias: ZENITH_PUBLIC_URL_API
      services: [app]
```

A labelled endpoint has its own canonical Zenith URL. Use `ZENITH_PUBLIC_URL_<LABEL>` instead of constructing its hostname. Convert the label to uppercase and replace hyphens with underscores. For example, `admin-api` becomes `ZENITH_PUBLIC_URL_ADMIN_API`.

## Check redirects and host validation

Open the returned deployment URL and check generated links and redirects. If you use a verified custom domain, repeat the checks there. Configure your app to accept the intended hostnames and use the correct public URL for callbacks.

For Zenith identity callbacks on either origin, follow [Sign in with Zenith](https://docs.zenith.hosting/content/sign-in-with-zenith).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.