---
search:
  tags:
    - edge
    - POST
seo:
  description: >-
    Like a site's custom domains (POST… Reference for the POST
    /v1/sandboxes/{sandbox}/ports/{port}/domains endpoint in the pols.so API.
sidebar:
  label: Serve a published port at a custom domain
  badge: POST
title: Serve a published port at a custom domain
type: openapi-operation
---
Like a site's custom domains (`POST /v1/sites/{site}/domains`),
with the same DNS records, checks, statuses and limits (an org's
20 count its sites' and ports' domains together; a port has 10 at
most): adds a host of the org's own, pending, and checks its DNS
at once. A subdomain's `CNAME` goes to the port's host,
`<sandbox>-<port>.<sandbox domain>`; an apex gets `A` (and
optionally `AAAA`) records to the pols edge. Once verified, the
edge serves the port there over HTTPS exactly as on the port's
own host: public or private as the port is (a private port's
login link from `POST .../ports/{port}/link` works on the custom
domain too, with the domain as its host), waking the sandbox from
standby, with WebSockets.

The port must be published (409 `conflict`). Unpublishing it later
keeps its domains, verified, and the edge answers 404 there until
it is published again; deleting the sandbox removes them. A host
the org has on one of its sites or other ports is refused (409
`conflict`) unless `move` is set, which moves it here keeping its
verification and certificate (no re-verification or new
certificate); it is checked again right away, and the edge serves
it here once it next refreshes its list of domains (every 30
seconds), answering 404 there until then.

`POST /v1/sandboxes/{sandbox}/ports/{port}/domains`
