Question

www does not resolve to my site

So https://mysite.app works fine. When I add a CNAME record pointing to the same IP address and I open a web browser and enter https://www.mysite.app the web browser can’t find the address. when I do dig mysite.app

➜  ~ dig mysite.app 

; <<>> DiG 9.10.6 <<>> mysite.app
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25215
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;mysite.app.		IN	A

;; ANSWER SECTION:
mysite.app.	300	IN	A	104.21.62.165
mysite.app.	300	IN	A	172.67.137.137

;; Query time: 67 msec
;; SERVER: 216.254.136.227#53(216.254.136.227)
;; WHEN: Fri Sep 29 20:19:28 EDT 2023
;; MSG SIZE  rcvd: 77

… which looks OK. When I do dig www.mysite.app

➜  ~ dig www.mysite.app

; <<>> DiG 9.10.6 <<>> www.mysite.app
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 19555
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.mysite.app.		IN	A

;; AUTHORITY SECTION:
mysite.app.	1729	IN	SOA	guy.ns.cloudflare.com. dns.cloudflare.com. 2318571981 10000 2400 604800 1800

I see NO ANSWER section and the Authority is Cloudflare(my caching DNS) How do I fix this so that www.mysite.app goes to the IP address?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
October 4, 2023

Heya,

As per Bobby’s comment you should not point the CNAME to an IP address really. CNAME records define aliases for A records by pointing one domain to another domain instead of to an IP address. Because a CNAME record maps to a hostname instead of an IP address, any A record changes for the hostname will not affect the functionality of the CNAME record. It will always connect to whatever IP address is currently associated with the hostname.

https://docs.digitalocean.com/glossary/cname-record/

If the DNS is managed via CloudFlare you can modify the record from their control panel and then just wait for the DNS propagation which is around 48 hours, but usually the record will start resolving a lot quicker.

Regards

Bobby Iliev
Site Moderator
Site Moderator badge
October 2, 2023

Hi there,

I believe that the problem is that you’ve added an IP address as a CNAME record, you should not really have an IP address as a CNAME record, but instead, you should add either a CNAME record for your www version to point to your domain or an A record.

What you could do is, in Cloudflare:

  • Click on “Add Record”.
  • Select the record type as CNAME.
  • For the Name field, enter www.
  • For the Target field, enter mysite.app (or the value you want it to point to, which could be another hostname if required).
  • Click on Save.

Then give it a couple of hours for the DNS cache to clear over the Globe.

Let me know how it goes!

Best,

bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel