1

My website is hosted by the same company from which I bought DNS. This company also takes care of my emails.

Now, however, I want to host my website on a different service, while the other services (email, ftp, smtp...) would remain on the old host. The instructions at my new host are to add my domain.sk and www.domain.sk as CNAME records pointing to their server.

However, I'm worried that this will make my emails not work.

Current setup:

domain.sk.    IN NS  ns.exohosting.sk.  
domain.sk.    IN NS  ns1.exohosting.eu. 
domain.sk.    IN NS  ns3.exohosting.cz. 
domain.sk.    IN A   92.240.253.107 
domain.sk.    IN MX  10 relay.exohosting.sk.      
domain.sk.    IN MX  10 relay1.exohosting.sk.     
domain.sk.    IN MX  20 relay2.dnsserver.eu.      
domain.sk.    IN MX  15 relay3.dnsserver.eu.      
smtp.domain.sk.   IN A   92.240.253.56    
mail.domain.sk.   IN CNAME   pop3-imap.dnsserver.eu.      
*.domain.sk.  IN A   92.240.253.107   
ftp.domain.sk.    IN CNAME   ftpcluster.dnsserver.eu.     
setup.domain.sk.  IN CNAME   setup.dnsserver.eu.      
webmail.domain.sk.    IN CNAME   webmail.dnsserver.eu.    
wapmail.domain.sk.    IN CNAME   wapmail.dnsserver.eu.    
webftp.domain.sk. IN CNAME   webftp3.dnsserver.eu.    
stats.domain.sk.  IN CNAME   stats1.dnsserver.eu.     
autoconfig.domain.sk. IN CNAME   autoconfigcl.dnsserver.eu.   
autodiscover.domain.sk.   IN CNAME   autoconfigcl.dnsserver.eu.  

To be added according to new host:

www.domain.sk.    IN CNAME   webapp-XXXX.pythonanywhere.com.    
domain.sk.    IN CNAME   webapp-XXXX.pythonanywhere.com.    
emihir0
  • 113
  • 3
  • 1
    Bah! I'm at home now and have had a chance to give your question some proper thought. I've done a few experiments and found that you can't have a CNAME record that is the same as any other resource record. You accepted my answer too quickly; Andreas Rogge's answer should be accepted instead of mine. I'm also upvoting your question because it's not as straightforward as it first appears. – Anthony Geoghegan Jun 06 '17 at 20:30

2 Answers2

3

You can’t create a CNAME record with the same name as any other resource record so, unfortunately, you won’t be able to replace the domain.sk A record with a CNAME record.

BIND and other name servers will prevent you from creating a CNAME record that masks other resource records. I presume the web interfaces of DNS hosts will also throw an error.

You can add the www subdomain as a CNAME record since this doesn’t conflict with any other resource records.

www.domain.sk.    IN CNAME   webapp-XXXX.pythonanywhere.com.

For the bare domain, I’d agree with Andreas Rogge’s suggestion of configuring a web server for domain.sk with your current host so that HTTP requests for domain.sk are redirected to www.domain.sk. I’d also suggest using a 301 Moved Permanently redirect so that search engine page rank is preserved.


If you’re changing web hosts and you want to have other separate websites available by subdomains such as myapp.domain.sk but hosted on pythonanywhere.com, you could replace the wildcard A record with a wildcard CNAME record:

*.domain.sk.    IN CNAME   webapp-XXXX.pythonanywhere.com.

Presumably the hosting nameserver supports wildcard CNAME records. See Is a wildcard CNAME DNS record valid?

Anthony Geoghegan
  • 2,800
  • 1
  • 23
  • 34
1

You cannot add the following record:

domain.sk.    IN CNAME   webapp-XXXX.pythonanywhere.com.

As the CNAME would redirect all RRs for domain.sk. This will also override your NS and MX records and will break things.

You can however, change the A record for domain.sk. to point to the IP Address where wepapp-XXXX.pythonanywhere.com. points to. However, this will not be auto-updated if that address ever changes.

Maybe you can set up a simple http-redirect-service somewhere and let domain.sk. point to that. The redirect would then redirect to www.domain.sk which can be a CNAME.

Andreas Rogge
  • 2,670
  • 10
  • 24