# Domains on Northflank

You can add your own domains to your Northflank team to use with your applications and services. There are many ways to configure your domains on Northflank to allow flexibility, security, and dynamic provisioning of subdomains.

After adding your domain to Northflank you can then add subdomains and configure paths for them, which can then be linked to ports. You can enable CDNs for your subdomains to cache and serve content.

You can add domains with wildcard redirect routing and certificate generation to enable dynamic provisioning of subdomains on Northflank.

## Custom domains and subdomains

To add and use subdomains on Northflank you must first add and verify the root domain on your DNS provider.

Once you have added a subdomain to your team it can be linked and unlinked to your service's ports using paths without having to configure it again in your DNS provider.

If you want to make a port on a service publicly accessible without adding your own domain, you can use the subdomain generated by Northflank.

- [Add a domain: Add your domain name to your Northflank account.](/v1/application/domains/add-a-domain-to-your-account)
- [Use your apex domain: Use your apex (root) domain name with a Northflank service.](/v1/application/domains/add-a-domain-to-your-account#add-a-domain)
- [Link a domain to a port: How to link and unlink domains and subdomains with specific ports on your deployments.](/v1/application/domains/link-a-domain-to-a-port)
- [Remove a domain from your account: How to remove subdomains and domains from your Northflank account.](/v1/application/domains/remove-a-domain)
- [Use Northflank generated DNS entries: Learn about Northflank-generated DNS entries for your private and public ports.](/v1/application/network/configure-ports)

## DNS providers

Follow guides on how to add and verify your domains from different DNS providers.

- [Add a Cloudflare domain: Add, verify, and configure a Cloudflare domain on Northflank.](/v1/application/domains/domain-registrar-guides/add-a-cloudflare-domain-to-northflank)
- [Add an NS1 domain: Add, verify, and configure an IBM NS1 Connect domain on Northflank.](/v1/application/domains/domain-registrar-guides/add-an-ns1-domain-to-northflank)
- [Add an OVH domain: Add, verify, and configure an OVH domain on Northflank.](/v1/application/domains/domain-registrar-guides/add-an-ovh-domain-to-northflank)
- [Add a Namecheap domain: Add, verify, and configure a Namecheap domain on Northflank.](/v1/application/domains/domain-registrar-guides/add-a-namecheap-domain-to-northflank)

## Path-based routing

You can [use path-based routing](use-path-based-routing) on subdomains to route requests to specific paths to different ports and services, and configure settings for how requests to that path are handled.

- [Use path-based routing: Route incoming traffic to different services and ports for paths on a subdomain.](/v1/application/domains/use-path-based-routing)
- [Configure request handling: You can configure how requests to a subdomain or specific paths are handled, such as modifying headers and setting the CORS policy.](/v1/application/domains/use-path-based-routing#configure-a-path)

## Certificate generation

Northflank uses Let's Encrypt to provision TLS certificates on-demand. Your [custom domains](https://northflank.com/docs/v1/application/domains/domains-on-northflank) can be linked to a service port and immediately start serving traffic securely with a managed certificate.

You can reduce the number of certificates you need to generate by configuring a domain to use wildcard certificates, and import your own certificates.

- [Generate certificates automatically with Northflank: Northflank will generate certificates for your domains automatically when they are added to a service port.](/v1/application/domains/certificate-generation#automatic-certificate-generation)
- [Import a certificate: Import your own certificate to use with your Northflank domain.](/v1/application/domains/certificate-generation#import-a-certificate)
- [Connect to an Addon with TLS: Ensure your service or job can connect to an addon using TLS.](/v1/application/databases-and-persistence/access-a-database#access-tls-certificates-in-containers)
- [Use wildcard certificates: Use wildcard certificate generation to avoid hitting certificate creation rate limits and dynamically generate subdomains.](/v1/application/domains/wildcard-domains-and-certificates#wildcard-certificate-generation)

## Wildcard redirects

You can configure wildcard redirect routing to add subdomains without adding DNS records for each new subdomain.

You can combine this with wildcard certificate generation to dynamically add subdomains in [Northflank templates](https://northflank.com/docs/v1/application/release/configure-a-release-flow) and [preview environments](https://northflank.com/docs/v1/application/release/set-up-a-preview-environment).

- [Use wildcard redirect routing: Configure your domains to use wildcard redirect routing to automatically verify subdomains added to Northflank.](/v1/application/domains/wildcard-domains-and-certificates#domain-routing)
- [Redirect all subdomains: Create wildcard subdomains to redirect all requests to a single domain or subdomain.](/v1/application/domains/wildcard-domains-and-certificates#redirect-all-subdomains)

## Content distribution networks

You can use a CDN to serve static content from your deployments. This can improve the speed at which your content is delivered to users without needing to deploy in multiple regions, and can reduce the load on your containers from serving many simultaneous requests.

Using a CDN also means that your can deliver stale content, so your site will remain accessible even if your deployments becomes unavailable.

- [Use a CDN: Configure your subdomains to use a CDN to serve static content.](/v1/application/domains/use-a-cdn)

## Cross-Origin Resource Sharing (CORS)

Applications that you write or deploy with a microservices or client-server architecture (for example, separate front and back-ends) will often require [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) access, which only accepts requests from specified domains.

Requests between your services, or even requests to the same service on different ports, may fail unless configured correctly. You may need to add the accepted domains as build arguments or environment variables to your services.

Some applications may have stricter policies and only accept requests from the same root domain. Northflank-generated `*.code.run` domains for public ports, even if they are on the same service, will be considered as different root domains. You should use your own subdomains for production services.

You can also configure your own CORS policies for individual paths on your own subdomains.

- [Add a domain: Add your domain name to your Northflank account.](/v1/application/domains/add-a-domain-to-your-account)
- [Use path-based routing: Route incoming traffic to different services and ports for paths on a subdomain.](/v1/application/domains/use-path-based-routing)
