Does alias supposed to rewrite CNAMEs for external domains too?
Closed this issue · 5 comments
Let's say I have the following dns file:
example.org. 3600 IN CNAME twitter.org.
And I have alias
and forward
plugins enabled:
. {
log
forward . 1.1.1.1 1.0.0.1
}
example.org {
file db.example.org
alias
}
When I dig example.org, I see that DNS response contains both CNAME and A records (resolved from twitter.com). Is it possible to remove CNAME records and just respond resolved A records?
I'm new to CoreDNS stuff, so sorry if I misunderstood something.
I'm not sure if there's something wrong with your configuration, but this is what I'm getting:
$ cat db.example.org
@ 3600 IN SOA ns.icann.org. noc.dns.icann.org. 2019121376 7200 3600 1209600 3600
3600 IN NS a.iana-servers.net.
example.org. 3600 IN CNAME twitter.org.
$ cat Corefile
. {
log
forward . 1.1.1.1 1.0.0.1
}
example.org {
file db.example.org
alias
}
$ dig @127.0.0.1 example.org
...
;; QUESTION SECTION:
;example.org. IN A
;; ANSWER SECTION:
example.org. 1800 IN A 104.244.42.1
example.org. 1800 IN A 104.244.42.65
;; AUTHORITY SECTION:
example.org. 3600 IN NS a.iana-servers.net.
;; Query time: 413 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Mar 20 11:55:33 +08 2022
;; MSG SIZE rcvd: 137
Ouch! Thanks for the reply. For a moment I thought maybe this plugin only supports CNAME aliases for internal names. Probably something is wrong with my config or coredns build.
Actually tried it again with a few more options. It looks like alias works with root domains but not with subdomains.
Oh, it only works for root domains because subdomains don't really need to be aliased. I could add an option to make this plugin work for all requests, not just apex requests.
Oh, it only works for root domains because subdomains don't really need to be aliased. I could add an option to make this plugin work for all requests, not just apex requests.
Yeah that makes sense. No don't worry, I think my case is some edge-case, no need to modify current behavior. I ended up writing a small dns server to make sure it behaves as I expected. (I tried to modify this plugin to support that behavior but couldn't find a reliable way to do 😅)
Anyways, thanks for the replies!