Back

Unreachable CNAME target when adding custom domain

  • 0
  • Self Hosted
  • General
Nevus
3 Apr, 2023, 03:17

I have an appwrite session behind apache proxy at appwrite.suven.com.np. The environment variables _APP_DOMAIN and _APP_DOMAIN_TARGET are set to appwrite.suven.com.np. The DNS has an A record pointing to the IP of the server. Using login from another page hosted at project.suven.com.np works but logs Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint. to the console. Trying to add custom domain for appwrite.suven.com.np from the project settings returns 500 errors. The logs from docker is:

TypeScript
appwrite  | [Error] Method: POST
appwrite  | [Error] URL: /v1/projects/:projectId/domains
appwrite  | [Error] Type: Appwrite\Extend\Exception
appwrite  | [Error] Message: Unreachable CNAME target (appwrite.suven.com.np), please use a domain with a public suffix.
appwrite  | [Error] File: /usr/src/code/app/controllers/api/projects.php
appwrite  | [Error] Line: 1344

The documentation for adding custom domains mentions adding a CNAME record. What does that mean? For which URL should the CNAME record be set and what should it point to?

TL;DR
The user is experiencing issues adding a custom domain to their appwrite.suven.com.np domain. They are seeing a "Unreachable CNAME target" error and are unsure how to resolve it. There is a suggestion to create an issue for the problem with the com.np TLD. Another suggestion is to create a subdomain for appwrite, such as appwrite.project.suven.com.np. The user also asks about the CNAME record and where it should be set, but no solution is provided.
Drake
3 Apr, 2023, 03:23

What did you add for your custom domain?

Drake
3 Apr, 2023, 03:25

You shouldn't need to add your main domain as a custom domain. To make the warning go away, I think you need a domain that is a sub domain of your app. So appwrite.project.suven.com.np

Drake
3 Apr, 2023, 03:29

However....I think the problem here is we don't recognize com.np as a valid TLD...you might want to create an issue for that

Nevus
3 Apr, 2023, 03:38

I tried suvenpandey.co and even google.com. It shows the same error on docker logs (with different timestamps ofc). The url on Message: Unreachable CNAME target (appwrite.suven.com.np), please use a domain with a public suffix. remains the same. ๐Ÿค”

Drake
3 Apr, 2023, 03:40

This value comes from your domain target environment variable

Nevus
3 Apr, 2023, 03:41

So what did Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint. message mean?

Drake
3 Apr, 2023, 03:41

Appwrite isn't a subdomain of your front end app

Drake
3 Apr, 2023, 03:42

So it's saying to create a custom domain that makes Appwrite a sub domain of your front end app.

But Appwrite thinks your domain target is invalid

Nevus
3 Apr, 2023, 03:49

I tried putting the frontend both above and below appwrite ie Appwrite at appwrite.suven.com.np Frontend at suven.com.np and appwrite at same url but frontend at appwrite.test.suven.com.np Maybe its the issue with .np country tld.

Nevus
3 Apr, 2023, 03:50

On which repo should I create issue for this?

Drake
3 Apr, 2023, 03:55

Weird...it should work with Appwrite at appwrite.suven.com.np and front end at suven.com.np

Drake
3 Apr, 2023, 04:01

Is your Apache proxy forwarding the host header?

Drake
3 Apr, 2023, 04:03

Oh wait...NVM...yes, it's a problem with the com.np TLD

Drake
3 Apr, 2023, 04:03

You can create it in the appwrite repo

Nevus
5 May, 2023, 11:31
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more