Skip to main content

Domains

Defang helps you provision SSL certificates and expose your services to the internet. You can expose your services using Defang-hosted domains or bring your own custom domain with Defang BYOC. This page explains how to configure your services to be accessible from the public internet.

Defang-hosted Domains

To make your service accessible from the public internet with Defang-hosted domains (under defang.app), you simply expose ports in your service definition.

Structure

Defang-hosted domains use a structure that is based on your username and service name.

If you have a publicly accessible service, you will automatically receive a domain to access it. If you're deploying to the Defang Playground, your domain will be structured as follows:

https://<username>-<service-name>--<port>.defang.dev

Sample Configuration

services:
# [...]
serviceName:
ports:
- mode: ingress
target: 3000
protocol: http

Bring Your Own Domain

If you are using Defang BYOC, you can bring your own custom domain to use with your services.

There are two main limitations to keep in mind when using Defang BYOC:

  1. You can only use one domain per service.
  2. Currently you must host your domain's DNS with the provider you are using.
NS Records

If you want to use your existing DNS provider for other aspects of your system, you can do so and just point a subdomain to your provider's nameservers using NS records.

Sample Configuration

services:
# [...]
serviceName:
domainname: example.com
ports:
- mode: ingress
target: 3000
protocol: http