CNAME and TXT at same name

I am using replit as my web hosting and I want to add a custom domain and they require to add a txt and a cname in the same host name which is not supported

This is not possible. The reason is that the DNS specification explicitly does not allow it.

In short, CNAME causes a name to be replaced by another name. The full name is replaced, independently of the record type – in other words, when there’s a CNAME, no other records are allowed at the same name.

However, at the root of your domain (“apex”), there are several other records, such as the apex SOA record and NS records (which are required to be there for DNS to work correctly), and the DNSKEY records (amongst others) which are necessary for DNSSEC to operator correctly.

If there’s a CNAME at the apex, resolvers would not be able to retrieve the domain’s DNSKEY record (because they would instead be redirected to the alternative name), and thus could not validate responses.

The DNS community clearly holds the opinion that CNAME at the apex working under some circumstances it is an accident, and also not reliably. It’s a bad idea, and not good practice to recommend it.

To achieve a CNAME-like effect for web sites, the HTTPS record is available and, today, also widely supported (see https://blog.apnic.net/2022/08/10/the-https-record-passes-a-key-milestone/). Ideally, Bear should update their docs and recommend that instead.

For details, see Retrieving and Creating DNS Records — deSEC DNS API documentation

Does that help?

Stay secure,
Peter

Thanks for helping have a nice day