I am using Enom.com's DNS Servers to manage several domains' DNS settings. I'm having trouble understanding how to correctly set up the DNS so that all http requests will resolve to a naked domain without resulting in example.com redirected you too many times
error.
So, regardless of any of the following:
http://www.example.com
http://foo.example.com
http://*.example.com
The DNS record should always redirect to the naked domain of http://example.com
IIS Server (Windows 2016)
Further, I'd prefer not to set up an IIS URL Rewrite with a Canonical Domain Name rule for every domain. My preference is to have the DNS records simply resolve everything back to the naked domain.
IIS Host Records
My server relies heavily on Host Header Records to correctly resolve the incoming request to the correct website. In other words, several domains' A Records point to the same IP Address on my server.
Current DNS Record Configuration (with Enom)
Host Name Record Type Address
www URL Redirect example.com
@ (none) A (Address) 1.2.3.4
* (all others) URL Redirect example.com
The URL Redirect record is a special record Enom provides. From the Enom Host Records help page:
URL Redirect is not a native DNS record type. Specifying URL Redirect for a hostname creates an underlying A record that directs the name to our URL Forwarding servers. These servers then perform an HTTP 301 redirect to the URL you specify in the address field. You can specify only the domain name to go to, or a full path to a specific file.
Summary of Question
How can I set up the DNS Records so that all variants of a domain are always sent to the naked domain without having to use an IIS URL Rewrite rule?
DNS cant redirect users. You have to configure your webserver (iis in this case) to redirect (301) users that type www.domain.tld to domain.tld. DNS only resolves names... You can setup a "redirect virtual host" that is a catch-all to redirect users to your main site (google "wildcard subdomain"). I've done this with apache (except the other way around, i wanted the www... I'm old fashioned)