> Index of every page on this site: [llms.txt](https://docs.a-line.cloud/llms.txt)

# Domains and certificates

> Route your own host names to apps over HTTPS.

## Organization domains

Before an app can use a host name under your domain, you add the domain to
the organization and prove you own it with a DNS `TXT` record. A
verification can cover one host or the whole domain; wildcard routes need the
whole domain.

## App domains

An app domain routes a host name to a port of an app. The protocol is
`https` by default; `http`, `tcp`, `udp` and `tls` (TLS passthrough) are also
possible. HTTP routes can match a path prefix.

A TCP route can send the PROXY protocol header, so the app sees the
client's address instead of the load balancer's. The app must accept the
PROXY protocol on that port, or its connections break.

Point the host at the cluster in one of two ways. The console calls this the
**DNS setup**:

- **Point to load balancer IPs** (the default, `a_records` in IaC): `A`/`AAAA`
  records to the cluster's addresses.
- **CNAME to A-Line hostname** (`cname` in IaC): a `CNAME` to a platform host
  name. This does not work at the apex of a domain (`example.com` itself).

The app's domain list shows the DNS records to create. For the steps and how
to choose, see [Add a custom domain](/guides/custom-domain).

## Certificates

HTTPS certificates are issued automatically through ACME once
DNS points at the cluster. A domain's TLS state is `pending`, `issued` or
`failed`, with the error when it failed. Per-app HTTP settings control the
HTTP-to-HTTPS redirect, HSTS and security headers.

### Behind a CDN or proxy

A CDN in front of a domain (Cloudflare proxied, with "Always Use HTTPS" or
Full (strict)) answers the HTTP challenge itself, so a certificate issued
over HTTP fails. Mark the domain as behind a proxy and A-Line gives it an
ACME challenge delegation: the app's domain list shows a record to create,

```txt
_acme-challenge.shop.example.com  CNAME  _acme-challenge.<random>.acme.<platform zone>
```

and the certificate is then issued over DNS through that CNAME, which works
whatever the CDN does with HTTP. Use **Check CNAME** to see whether the
record is in place, missing or wrong. A wildcard route's certificate uses the
same kind of record, set up on the organization domain.

The CNAME is a standing grant: for as long as it exists, A-Line can get
certificates for that name. Each target is random, belongs to your
organization only and is never given to anyone again, and removing the
delegation (or the domain, or the organization) stops A-Line answering
challenges under it. Delete the `_acme-challenge` CNAME at your DNS provider
when you remove the delegation or stop using the domain with A-Line.

For the full setup per CDN (Cloudflare, Fastly, Bunny, CloudFront), the
caching defaults and troubleshooting, see [Use a CDN or proxy](/concepts/cdn-proxy).
