问题原文
原帖链接 · blackboxlogic · CC BY-SA 4.0
Context
I'm playing with basic hosting and DNS. I have a static page hosted at example.github.io which is referenced by a CNAME at example.com which is the URL I want visitors to see.
I want to use various tools (Google Search Console, Bing Webmaster Tools, KeyBase proof) which require I prove ownership of the domain by adding a TXT record with a unique identifier for each service.
I've added the TXT records to example.com but it "isn't working"*, which makes some sense to me, since CNAME and TXT records can't cohabitate. I haven't found a way to add TXT records directly to the GitHub page since the name server isn't under my control.
"Isn't Working"
The webmaster tools find the TXT record, but are not showing any information about the site or its content, as if they aren't finding it. KeyBase has told me that it doesn't see the TXT record at all (it worked momentarily when I removed the CNAME, but that broke the site).
Questions
Is it possible to add TXT records to a static site hosted on GitHub?
Have I revealed some fundamental misunderstanding about DNS, and can you point it out where I've gone astray?
Is this just not possible?
已采纳解答
原帖链接 · Stephen Ostermiller · CC BY-SA 4.0
You can't use a CNAME at your domain apex (the @ record for no subdomain) regardless of whether or not you also want TXT records. It breaks all other needed records like NS, SOA, and MX records. DNS servers shouldn't even allow you to put a CNAME record at the apex. If you manage to do so, things break subtly. For example your domain's email will not be properly delivered.
Instead of using a CNAME you need to use A, AAAA, or ALIAS records according to instructions from Github.
Once you have properly configured your DNS such that it doesn't have a CNAME record at the apex, you can add TXT records to verify your site.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
