Skip to main content
A distribution has an assigned Aptranet hostname and can serve custom hostnames such as cdn.example.com. Configure three separate connections: DNS directs visitors to the distribution, visitor TLS protects the client connection, and origin TLS protects the edge-to-origin connection.

Before you begin

  • Verify a known file using the CDN quickstart.
  • Have access to the custom hostname’s authoritative DNS.
  • Have permission to edit the distribution’s Network and TLS settings.
  • For a production hostname, save the current DNS target and TTL for rollback.
Use a new test hostname for your first setup. A hostname’s readiness can depend on DNS pointing to the distribution, so plan a production cutover around both DNS and certificate readiness.

1. Add the custom hostname

Open the distribution’s Network page. Add cdn.example.com to the custom hostnames and save the configuration. Enter a hostname without a URL scheme, port, or path. A hostname must not already belong to another distribution. The assigned aptranetedge.com hostname is managed by Aptranet; do not add it as a custom hostname. Copy the distribution’s root hostname. For API updates, read the current network configuration and preserve all existing hostnames and network settings; see update configuration.

2. Point DNS to the distribution

For a subdomain, create a CNAME with these values at your DNS provider: Do not point the custom hostname to the origin. Keep the origin hostname resolving to the origin itself to avoid a delivery loop. For an apex name such as example.com, confirm your DNS provider’s supported approach before cutover. Cloud DNS rejects apex CNAME records. Do not assume a subdomain CNAME procedure works at the apex. Verify the record:
A custom hostname can remain in provisioning while DNS does not point to the distribution. Check the saved hostname state after DNS is visible.

3. Configure visitor HTTPS

Open TLS and enable HTTPS. Use automatic certificate management or select an imported certificate from the same project. An imported certificate must cover the custom hostname and include its required chain. Check managed issuance and certificate status in TLS Manager. DNS routing, hostname status, and certificate readiness are separate checks: an active hostname alone does not prove HTTPS is ready. Keep SSL 3.0, TLS 1.0, and TLS 1.1 disabled for normal production use.

Certificate selection through the API

The full TLS configuration accepts optional certificate_id: HTTPS must be enabled before attaching a certificate. Omitting certificate_id does not switch an imported certificate back to automatic management.

4. Configure origin TLS separately

Visitor HTTPS does not determine whether the edge uses HTTPS to your origin. A valid visitor certificate cannot fix an origin certificate mismatch. Correct the origin certificate, Host header, or SNI rather than disabling validation to conceal a mismatch.

5. Test the custom hostname

Request a known file over HTTPS without --insecure:
Check the status, file contents, and certificate validation. Then enable the HTTP-to-HTTPS redirect and verify that an HTTP request redirects to the intended HTTPS URL.

Test routing before public DNS changes

When the custom hostname is already configured and its certificate is ready, --connect-to lets you connect through the assigned distribution hostname while retaining the custom hostname for HTTP Host and TLS SNI:
This verifies the request path for your client. It does not change public DNS, complete domain validation, or prove that other clients reach the distribution.

Troubleshoot hostname setup

For rollback, restore the previous DNS target and keep both delivery paths available while caches expire. Do not delete the distribution or certificate until clients have stopped using them.