---
title: Domains
description: A hostname the edge answers for, routed to a service, with DNS and a certificate.
order: 3
---

A domain routes a hostname to a service of the same environment. Ops writes its DNS record
when it holds the zone, and a certificate is issued on the first request and renewed by
itself. [Add a domain](../get-started/add-a-domain.md) walks through the first one.

## Fields

| field | in the project file | what it does |
| --- | --- | --- |
| Hostname | `hostname` | the address, set per environment |
| Extra hostnames | `aliases` | more hostnames on the same site, such as `www.` or a `.com` twin |
| Target | `target: { service, port }` | the service in front; the port defaults to the service's own |
| API route | `api: { service, port, path }` | a path sent to another service, default `/api/*` |
| Probe path | `probe_path` | the path ops checks, default `/` |
| On the public status page | `public_status` | shows the domain on the status page, default off |
| Zone | `zone` | `ops` (default) when ops holds the zone, `external` when you do |

## Your own zone

With `zone: 'external'`, or a hostname in a zone ops does not hold, the domain's page shows
the record to add at your DNS provider: an `A` record, or a `CNAME` where your provider
allows one. **Copy** takes the whole block. Ops checks again by itself until the record
resolves, and **Check now** asks at once.

## The service learns its address

A service that sets `address` in the project file gets the domain's `https://` address
and its origins in its secret group, so links your app sends always match the hostname.
See [The project file](../concepts/project-file.md#services).

## Previews

Each preview gets one domain of its own, on a preview hostname ops picks, with its own
certificate. The pull request comment carries the address.
