Appwrite custom domains allows you to use your own domain as your Appwrite API endpoint.
A recent change made in modern browsers will not allow your web app to use 3rd-party cookies. This change is done to protect your users' privacy from malicious web tracking services.
When accessing Appwrite from a 3rd party domain, like cloud.appwrite.io or example.com, some browsers will treat our secure cookies as 3rd-party cookies and block them, as a fallback Appwrite will store your users' sessions on the browser localStorage.
Using localStorage is very convenient to help you get started quickly with Appwrite, but it is not the best practice for your users' security. The browser localStorage can't protect your users' sessions from being hijacked by a 3rd party script or an XSS vulnerability in your web app.
To prevent your browser from blocking your cookies, your Appwrite API endpoint should be set to under same domain of your web app's domain. When accessing Appwrite from the same domain as the one your app uses, Appwrite cookies will no longer be treated as 3rd-party cookies by any browser and will store your users' sessions securely.
For example, if your app runs on my-app.com, you can set the subdomain appwrite.my-app.com to access the Appwrite API. This will allow browsers to respect the Appwrite sessions cookies as they are set on the same domain as your app.
Go to the Appwrite Console and navigate to your project.
Click on the Settings tab in the left sidebar.
Select the Custom domains section and click Create domain.
Add your domain, and copy associated CNAME record to your DNS provider. See the Add a CNAME record section.
Verify your domain. DNS changes might take up to 48 hours to propagate worldwide, you may not be able to do this in the same day.
Once you verify your domain, you can generate an SSL certificate.
With these steps, your Appwrite project will accept API requests from your custom domain.
If you encounter any issues during the setup process or have questions, don't hesitate to contact us, and we'll be happy to assist you.
A CNAME record (or a Canonical Name record) is a type of resource record in the Domain Name System (DNS), which maps one domain name (an alias) to another.
Every DNS host has its own way of updating DNS settings, and, unfortunately, their dashboard interfaces usually aren't the most intuitive. We recommend that you read the help documentation of your DNS host, also do not hesitate to contact their support for help with their interface and settings.
Below, you'll find a list of registrars and links to their DNS setting documentation. If your domain provider isn't listed above, please contact us, and we'll include their settings as well.
DNS changes might take up to 48 hours to propagate worldwide. This means that it might take up to two days for your new domain to become accessible using Appwrite. For debugging, you can try using this online tool to check your DNS propagation status.
In addition to the DNS setup, you might also want to update the "Allowed Domains" section in your Appwrite project settings. By default, Appwrite only allows API calls from localhost, appwrite.io, and your project's default custom domains. You can add your custom domain to this list to ensure that API requests from your domain are accepted.