Title: masking heroku app from godaddy using cloudflare
Tags: heroku;cloudflare
Question: I am trying to set up my herokupapp with my custom domain name from Godaddy.  I hav gone through the process of getting it wokring using a cname through cloudflare.
Everything is working.  However, when I go to my hardygregory@example.org my browser changes the url to example.herokuapp.com.
Going to:  http://www.example.com/ and www.example.com do work
I don't want this obviously, what am I doing wrong?
Comment: NextJs.  But the links aren't based on the domain.

Comment: Yeah that is now working but without www it still shows up as herokuapp

Comment: When you go to stackyourprops.com it doesn't show tomskb.herokuapp.com in the browser

Comment: Yes I'm sorry, the other one started working halfway thrrough

Comment: There's a good chance your application code is doing this. Does it know its own domain, e.g. so it can build links properly? What technology did you use to build it?

Comment: Is it for the domain in your screenshot? I can get to `www.stackyourprops.com`, and the address doesn't update in my browser.

Comment: Okay, I'm a bit confused. Your question says "when I go to my hardygregory@example.org or example.com my browser changes the url to example.herokuapp.com". Is that not correct? You have now edited it to add "Going to: http://www.example.com/ does work I don't want this obviously", but there's nothing obvious about that. What, _specifically_, don't you want?

Comment: Okay, so it's _just_ the root domain that you're asking about? Because that's not what your question says.

Here is the accepted answer: Don't use an A record for your root domain. Heroku doesn't provide static IP addresses, so whatever value you put there won't be valid for long.
Since you're using CloudFlare you should be able to set up a CNAME for your apex domain just like you did for your www subdomain. CloudFlare has a feature called CNAME flattening that should make a CNAME on your root domain work as expected.
Regarding your comment that the www subdomain started working, that's typical of DNS changes. They take time to propagate. Give it some time.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 8, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2019:00:09/02/19', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<heroku><cloudflare>', 'Title': 'masking heroku app from godaddy using cloudflare', 'ViewCount': 224, 'id': 57756023, 'user_AboutMe': None, 'user_AccountId': 7945693.0, 'user_DisplayName': 'lakerskill', 'user_Reputation': 947.0, 'user_Views': 211.0, 'user_id': 9985440.0}}