---
layout: article
title: Domains
description: Discover how domains can be managed for an Appwrite Site
---

Each deployed site can have its own domain, which can be Appwrite-generated or custom. You can use this domain to consume web apps deployed on Appwrite Sites. Appwrite generates TLS certificates to enforce HTTPS on all Appwrite Sites domains. These domains are safe to use and access in production.

[Learn about Sites development >](/docs/products/sites/develop)

# Generated domains

Each site automatically receives a unique Appwrite-generated domain that's ready to use immediately.

1. In the Appwrite Console's sidebar, click **Sites**.
2. Under the **Domains** tab, you'll find the domain generated by Appwrite.

The domain usually has this format:

```bash
https://64d4d22db370ae41a32e.appwrite.network
```

## Branch and Commit URLs

Additional to the site URL, Appwrite also generates a URL for the branch and commit that your site has been deployed from. The branch URL will remain consistent for all deployments made for code pushed to a specific branch, whereas the commit URL will be updated every time a new deployment is made via the Git integration (i.e. when code is pushed to your repo).

{% only_dark %}
![Branch and commit URLs](/images/docs/sites/dark/branch-commit-urls.avif)
{% /only_dark %}
{% only_light %}
![Branch and commit URLs](/images/docs/sites/branch-commit-urls.avif)
{% /only_light %}

To find the branch and commit URLs of any deployment, follow these steps:

1. Navigate to your site on Appwrite Console.
2. Head to the **Deployments** tab and click on any deployment.
3. In the **Domains** section, click on the **+2** next to the mentioned domain.

# Add a custom domain

You can add your own domain to your Appwrite site to provide a branded experience for your users. There are two ways to add a custom domain, depending on whether you're using a subdomain or an apex domain.

## Add an apex domain with NS records

Apex domains (also known as root domains) are domains without a subdomain prefix, like `example.com` instead of `www.example.com`. Unlike subdomains, apex domains cannot use CNAME records due to DNS protocol limitations.

To add an apex domain via NS records:

1. Navigate to your site in the Appwrite Console.
2. Head to the **Domains** tab and click on **Add domain**.
3. Enter your apex domain (e.g., `example.com`).
4. Select the appropriate domain rule type (Active deployment, Git branch, or Redirect) and configure its settings. See the [Domain rule types](#domain-rule-types) section for details.
5. Appwrite will provide NS record information.
6. Go to your domain registrar and update the NS records for your domain to point to `ns1.appwrite.zone` and `ns2.appwrite.zone`.
7. Return to the Appwrite Console and wait for the verification process to complete.

{% only_dark %}
![Add domain](/images/docs/sites/dark/add-domain-ns.avif)
{% /only_dark %}
{% only_light %}
![Add domain](/images/docs/sites/add-domain-ns.avif)
{% /only_light %}

DNS changes can take up to 48 hours to fully propagate across the internet. During this time, your domain might not be accessible or might show inconsistent behavior.

### Why Appwrite uses NS records instead of A records

By [DNS standards (RFC)](https://datatracker.ietf.org/doc/html/rfc1035), apex domains cannot use CNAME records, only A or AAAA records, which require pointing to fixed IP addresses. Using A records would lock Appwrite into specific IP addresses, limiting our ability to optimize routing, scale our infrastructure, or make changes as needed. To avoid this constraint and maintain flexibility, Appwrite offers DNS delegation through NS records so we can manage routing on your behalf.

Using Appwrite's DNS servers for your apex domain provides several benefits:
- Proper SSL certificate management
- Automatic DNS configuration
- Secure and reliable DNS resolution

When you change your domain's NS records, you're delegating DNS management to Appwrite. This means any existing DNS records (like MX records for email) will need to be recreated in Appwrite's DNS configuration.

{% arrow_link href="/docs/products/network/dns" %}
Learn more about Appwrite DNS server
{% /arrow_link %}

## Add an apex domain without changing nameservers

To add an apex domain without changing your NS records via [CNAME flattening](/docs/products/network/dns#using-cname-flattening):

1. Navigate to your site in the Appwrite Console.
2. Head to the **Domains** tab and click on **Add domain**.
3. Enter your apex domain (e.g., `example.com`).
4. Select the appropriate domain rule type (Active deployment, Git branch, or Redirect) and configure its settings. See the [Domain rule types](#domain-rule-types) section for details.
5. Copy the **CNAME** record provided by Appwrite.
6. Copy the **[CAA](/docs/products/network/caa-records)** record provided by Appwrite.
7. In your DNS provider's settings, create an ALIAS, ANAME, or CNAME record at the apex (depending on what your provider supports).
8. Point the record to the Appwrite hostname provided in the console.
9. Add the [CAA record](/docs/products/network/caa-records) to your DNS provider's settings, also pointed at the apex. If you already have CAA records on your domain, keep them and add Appwrite's alongside them. See [Setting multiple CAA records](/docs/products/network/caa-records#multiple).
10. Return to the Site settings and wait for verification status.

{% only_dark %}
![Add domain](/images/docs/sites/dark/add-domain-cname.avif)
{% /only_dark %}
{% only_light %}
![Add domain](/images/docs/sites/add-domain-cname.avif)
{% /only_light %}

DNS changes can take up to 48 hours to propagate. Once verified, your apex domain will be ready to use with full control over your remaining DNS configuration.

## Add a subdomain with CNAME

Subdomains (like `www.example.com` or `app.example.com`) are set up using CNAME records, which point to Appwrite's hostname.

To add a subdomain:

1. Navigate to your site in the Appwrite Console.
2. Head to the **Domains** tab and click on **Add domain**.
3. Input your subdomain (e.g., `www.example.com`).
4. Select the appropriate domain rule type (Active deployment, Git branch, or Redirect) and configure its settings. See the [Domain rule types](#domain-rule-types) section for details.
5. Copy the specified **CNAME** record and add it to your domain registrar.
6. Return to the Site settings and wait for verification status.

{% only_dark %}
![Add domain](/images/docs/sites/dark/add-domain.avif)
{% /only_dark %}
{% only_light %}
![Add domain](/images/docs/sites/add-domain.avif)
{% /only_light %}

DNS records can take up to 48 hours to propagate. Once verified, the domain is ready to use.

## Domain rule types

When adding a custom domain to your Appwrite site, you'll need to select one of the following rule types that determine how your domain will behave:

### Active deployment

Points your domain to the latest deployed version of your site. This is the most common option for production domains.

- When selected, your domain will always serve the most recent successful deployment
- Any new deployments will automatically be available on this domain

### Git branch

Points your domain to a specific branch in your repository. This is useful for testing or staging environments.

- When selected, you'll need to choose a specific branch from your connected repository
- Your domain will always serve the latest successful deployment from that branch
- This allows you to have different domains for different branches (e.g., staging.example.com for your staging branch)

### Redirect

Forwards all traffic from your domain to another URL. This is useful for domain migrations or creating shortcuts.

- When selected, you'll need to specify the destination URL
- You can choose from various HTTP status codes for the redirect:
  - 301 Moved permanently
  - 302 Found
  - 303 See other
  - 307 Temporary redirect
  - 308 Permanent redirect

{% info title="Path and query parameters in redirects" %}
When you redirect an added domain to another URL, any additional path and queries will be ignored.

For example, if a domain `example.com` is set to redirect to `appwrite.io`, `example.com/docs?id=123` will also redirect to `appwrite.io`.
{% /info %}
