---
title: "pols domains"
description: "Serve sites and sandbox ports at custom domains"
---

<!-- Generated by scripts/reference.mjs from the pols CLI's --help. Do not edit; run `npm run reference:sync`. -->

A public or link site can be served at domains of your own too, like
www.example.com or example.com, besides \<name\>.on.pols.so. Add the domain,
then set the DNS records pols prints at your DNS provider: a CNAME to the
site's host for a subdomain, A (and optionally AAAA) records for an apex.
Once they point to the site, pols verifies the domain, gets its certificate
and serves the site there; pols domains check checks at once. A domain
another site uses needs its TXT record too. One verified domain can be the
site's primary domain: its other custom domains redirect there once it has
its certificate.

With `--sandbox` and `--port` instead of SITE, the domain serves a published
port of a sandbox (pols host) the same way, as on its
\<sandbox\>-\<port\>.on.pols.so host: public or private as the port is (a
private port's login link from pols host works on the domain too, with the
domain as its host). Unpublishing the port keeps its domains; deleting the
sandbox removes them. `--move` moves a domain from another of your sites or
ports, keeping its verification and certificate; the edge serves it at its
new target within 30 seconds, answering 404 there until then.

## Usage

```text
pols domains [command]
```

## Subcommands

| Command | Description |
| --- | --- |
| [`pols domains add`](#pols-domains-add) | Add a custom domain to a site or port and print the DNS records to set |
| [`pols domains check`](#pols-domains-check) | Check a custom domain's DNS now |
| [`pols domains get`](#pols-domains-get) | Show a custom domain's status and the DNS records it needs |
| [`pols domains ls`](#pols-domains-ls) | List a site's or port's custom domains |
| [`pols domains primary`](#pols-domains-primary) | Make a verified custom domain the site's or port's primary one |
| [`pols domains rm`](#pols-domains-rm) | Remove a custom domain from a site or port |

## Flags

```text
-h, --help             help for domains
    --port int         the sandbox's published port, with --sandbox
    --sandbox string   a sandbox, for a domain of its --port instead of a SITE
```

## pols domains add

Add a custom domain to a site or port and print the DNS records to set

### Usage

```text
pols domains add SITE DOMAIN [flags]
```

### Examples

```sh
pols domains add my-docs www.example.com
pols domains add my-docs example.com
pols domains add example.com --sandbox web --port 8080
pols domains add example.com --sandbox web --port 8080 --move   # from a site
```

### Flags

```text
-h, --help   help for add
    --move   move the domain here from another of your sites or ports, keeping its verification
```

## pols domains check

Check a custom domain's DNS now

### Usage

```text
pols domains check SITE DOMAIN [flags]
```

### Flags

```text
-h, --help   help for check
```

## pols domains get

Show a custom domain's status and the DNS records it needs

### Usage

```text
pols domains get SITE DOMAIN [flags]
```

### Flags

```text
-h, --help   help for get
```

## pols domains ls

List a site's or port's custom domains

### Usage

```text
pols domains ls SITE [flags]
```

### Examples

```sh
pols domains ls my-docs
pols domains ls --sandbox web --port 8080
```

### Flags

```text
-h, --help   help for ls
```

## pols domains primary

Make a verified custom domain the site's (or port's) primary one: its other
custom domains then redirect to it, keeping the path, once it has its
certificate. \<name\>.on.pols.so keeps serving it. `--unset` makes it have no primary domain.

### Usage

```text
pols domains primary SITE DOMAIN [flags]
```

### Examples

```sh
pols domains primary my-docs www.example.com
pols domains primary my-docs www.example.com --unset
```

### Flags

```text
-h, --help    help for primary
    --unset   make the site or port have no primary domain
```

## pols domains rm

Remove a custom domain from a site or port; it stops being served there
within seconds. Remove its DNS records too: while they point to pols, anyone
could add the domain to their own site.

### Usage

```text
pols domains rm SITE DOMAIN [flags]
```

### Flags

```text
-h, --help   help for rm
```

The [global flags](/docs/reference/cli/#global-flags) work with this command too.
