How to correctly configure Heroku Custom Domain - heroku

When setting up my DNS my.domain.com (provided by GoDaddy) I am not sent to the correct address of my app, and the address in the URL bar is not what I expect either.
I have followed again and again the instructions outlined here: https://devcenter.heroku.com/articles/custom-domains#summary-of-steps
I have tried adding a record of type CNAME with host as www and the target URL as example-26hans7.herokudns.com
Two expectations are not met:
When I navigate to my.domain.com I am not brought to the app which I added a domain to in the Heroku CLI (my-app.herokuapp.com), but instead to an empty app page (example-26hans7.herokudns.com). The result is not the same if I navigate to my-app.herokuapp.com directly, then my app is loaded as expected.
The URL in the address bar I would like to be my.domain.com. At present it seems to be redirecting me and so the URL in the address bar becomes example-26hans7.herokudns.com. This is no good for production.
Any help in this matter greatly appreciated.

So it turns out you need to follow two steps in order for this to work with GoDaddy:
Create the CNAME as defined in the Heroku docs here: https://devcenter.heroku.com/articles/custom-domains
Enable forwarding. This can be found in the bottom right of the DNS management page. I had thought that forwarding was a redirecting option but it seems this needs to be enabled.
OPTIONAL: here you can also setup the subdomain such as example.com for www.example.com

Related

Setting up a GoDaddy domain name with Heroku

I'm new to using Heroku so I'm a bit confused because I initially had my website hosted on GoDaddy, but when I added node to my web app I switched to Heroku.
So what is happening is when I visit my website using www. it goes to the correct, updated site, however, when I try the naked route it takes it to the older version of the website. I figured since it's still showing the older site with the naked route that there was a problem on GoDaddy, therefore, I updated one page on GoDaddy and sure enough, the page is updated via the naked route now.
That leads to my first question. If my website is now on Heroku, does it still need to be hosted on GoDaddy as well? Additionally, if the first question is yes, then how do I set up the naked route to point to the same site as the www. route?
I've already have the host as www with the 'points to' pointing to the Heroku domain name but still getting the problem above. This is why I believe the problem lies with the hosting on GoDaddy.
You don't need to host a copy of your site at Goddady.
In Godaddy, you must have a CNAME www pointing to heroku:
your_application_name.herokuapp.com
or
www.your_application_name.com.herokudns.com.
To use heroku for your naked domain, you can define a redirection for the naked domain to your www:
Go to My domains (https://dcc.godaddy.com/manage/)
Click on Manage connection
Set forwarding option (choose www.your_application_name.com, forward type permanent)
This is what helped me as of 2019. First, get to the list of your domain(s) on GoDaddy's interface. You'll see something like this:
GoDaddy's all domains page
Choose your domain. Once you're on your domain's settings, scroll to the bottom and click on 'Manage DNS'. You should see some records created, if there are any.
ACTUAL CONFIGURATION
FIRST STEP:
Create a CNAME record(there should be an 'add' button somewhere). The record should have the following parameters - Type - CNAME, Host - www, Points to - enter the link heroku created for your app.
creating a CNAME record on GoDaddy's
Sometimes when there are other old CNAME records, it'll throw an error. Erase old CNAME records and try again.
SECOND step:
Go to your terminal and enter the command 'host www.yourdomain.com'. If the CNAME record was successful, you should see the heroku domain you enter earlier. IMPORTANT - You should also see a bunch IP addresses which we will need.
THIRD step:
Create 'A' records for all the IP addresses provided on the 'host www.yourdomain.com' terminal command. They should have the following parameters: Type - A, Host - #, Points to - IP address, choose TTL custom and type 600 seconds.
This should do it

website on Azure not Accessible due to www coming before websitename azurwebsites net

I have uploaded a Magento website to Azure website. It was working perfectly fine with websitename.azurewebsites.net
But when i tried to use a custom domain(I did the dns thing also). Whenever i go to the custom domain or with .azurewebsites.net it redirects to www.websitename.azurewebsites.net
Why is the www coming before websitename.azurewebsites.net ?
You configured your DNS with CNAME
www.websitename.azurewebsites.net
Check the guide you followed for DNS configuration and make sure "www" in the front is removed.

How to view my static website without storage.googleapis.com in the address

I am trying to build my first website on a domain that I purchased through Google Domains. I have followed this tutorial but am still unable to reach my site by visiting www.mysite.com
I have ensured that index.html and 404.html are set to public-read and I can see them by clicking on the public link button in the console, but that takes me to https://storage.googleapis.com/www.mysite.com/index.html
I want to simply be able to type www.mysite.com and see my index.html document.
I have added a record set with DNS Name www.mysite.com and Data c.storage.googleapis.com but still have no luck.
What am I missing?
UPDATE
This tool shared by a commenter below shed a bit more light on what seems to be causing the issue. It looks like my registrar setup is not finished, but I am not sure how to do so.
I noticed that when I search for www.mysite.com, every field says No record found, but when I search for just mysite.com (no "www"), some fields are populated (not AAAA, CNAME, A, SPF, SRV, TXT, SRV, or LOC, though)
I also noticed the "Registrar Setup" link on the Cloud DNS page, which says "This zone will not normally be usable until you register the related domain and configure these records with your registrar:" and lists ns-cloud-e1.googledomains.com for e1 through e4.
Why are fewer fields populated for www.mysite.com than for mysite.com, and what steps do I need to take to finish my registrar setup?
UPDATE: ANSWERED
I determined the issue and have posted the answer below
What error do you get exactly when you go to www.mysite.com? Does it resolve? Do you get a 404? Do you get the 404 you specified? Or a 404 from Google? Or something else?
Are you sure the CNAME is set correctly? You can check it with a tool like this:
https://www.ultratools.com/tools/dnsLookup
What happens when you go to www.mysite.com/index.html ? Did you assign pages?
https://cloud.google.com/storage/docs/hosting-static-website#optional_assigning_pages
I found the issue: I had added my CNAME entry on the Cloud Console > Cloud DNS page, rather than on my Google Domains registry. After removing the entry from the Cloud DNS page and adding it to the Google Domains Configure DNS page, my site is up and running.

Customize URL with Heroku and OVH

I push my app I create with Ruby on rails on heroku and I have by default myapp.herokuapp.com
I buy my domain name on OVH I do heroku domains:add www.myapp.co to redirect to myapp.herokuapp.com.
I want to have only www.myapp.co this target and keep this went I am on the app. Could you guide to configure it on OVH.
I read this https://devcenter.heroku.com/articles/custom-domains and do what they say i don't understand check my url synestasia.co
Thank your for your help. really don't understand.
Steps needed to point (redirect) your OVH root domain (eg. yourdomain.com) to your heroku application.
Go to domain section in OVH and select your domain. Then click DNS ZONE
Remove entries (you can omit this step but OVH will tell you the same when you try to add an entry): Domain: www.yourdomain.com with types of: CNAME yourdomain.com, TXT 3|welcome, TXT l|pl (but this may depend on the
language as I'm using PL language).
Add CNAME record with www subdomain and target to your heroku CNAME domain you have from heroku website eg. my-application-fcmnqo274218034.herokudns.com. Confirm clicking next and confirm next step too.
Go to the Redirection tab and click Add a redirection. Leave both fields blank (one with domain address where you need to fill subdomain and Also redirect www.yourdomain.com checkbox unchecked. Click Next.
In the next page you should see What type of target do you want to redirect yourdomain.com to? question. Select to a web address and click Next
Next page says What type of redirection do you want to use to redirect yourdomain.com ?. Select with a visible redirection. and click Next.
In the next window select Permanent (301) redirection and then you will be asked to provide your full address as in the placeholder eg. https://www.yourdomain.com, then click next and validate the redirect rule.
Domain propagation might take a while (up to ~24h but mine was ready in few minutes). To not cache domain pointing to the DNS in your browser (as this might be fooling your with your website not found but it might work for others) you might want to use some tool to check if domain points to new servers (eg. https://dnschecker.org - that's not spam, I have nothing common with them)
Thanks to this user for posting that solution: http://community.ovh.com/t/redirection-vers-app-heroku/6392/16
To serve your domain name from Heroku, you need to tell the DNS service you use where your server is hosted.
Typically, this is done by declaring an A record DNS entry: A records expect a static IP address and so you just fill in your server's IP.
The challenge with Heroku is that it uses dynamic IP addresses, so A records are not an option.
So the other option is to declare a CNAME record: a CNAME points a name to another CNAME or an A record.
Problem is: CNAMEs are NOT supposed to be used for root domains (AKA base domain or apex domain.) They will only work with subdomains.
So you could easily declare www.example.com to point to your Heroku app (on ANY DNS service, including OVH), but not example.com.
To help with this problem, some DNS services came up with their own solutions that basically let you point a root domain to another domain.
The Add a custom root domain section of the Heroku docs mentions a bunch of these providers:
ALIAS at DNSimple
ANAME at DNS Made Easy
ANAME at easyDNS
ALIAS at PointDNS
CNAME at CloudFlare -- a bit of a misnomer
OVH offers no such option (maybe unsurprisingly given most of their business comes from hosting servers.)
Bottom-line: if your domain name is provided by OVH, either use a subdomain (e.g.: www.mysite.com) or change your NS records to use a different DNS service, one that supports CNAME-like functionality at the apex.
I'm no sysadmin. I spent a lot of time on this issue too and hope this helps.
Heroku panel -> Your APP -> Settings -> Domains and certificates -> Add Domain.
Copy DNS Target
Log in OVH
WEB -> DOMAINS -> Your domain
DNS ZONE
Field: www.yourdomain.com | Type : CNAME | Target: yourdomain.com
Click " ... " -> Change Entry -> Delete Target -> Paste Heroku DNS Target + " . (dot)"
Sometimes you have to wait 24 hours.

Subdomains with CloudFlare

I'm using CloudFlare in my website and it works perfectly. Problem is, I decided to host my static files like JavaScript, CSS, etc. in static.example.com and I don't know how to set up the subdomain.
I already tried adding a CNAME record (static is an alias of example.com) and it didn't work, and as a A record (static points to IPAddress) where IPAddress is the IP address that both www and example.com use.
I'm I doing something wrong? I've waited about an hour for any DNS propagation problems and still doesn't work.
If you have added the subdomain in your CloudFlare DNS settings (settings->DNS settings), then it should start propagating out after a few minutes or so. If you're still having issues with the subdomain, please contact CloudFlare with the domain name so we can look at it.
I had the same issue until I realized I had to click on the greyed out cloud on that row to activate Cloudflare on the subdomain. This is what it currently looks like:
The instructions at the top of the page clearly say you have to do this, but I'm not one of those read the manual types for simple tasks. I guess what would have really got the point across was some sort of notice the very first time I added a subdomain on my account.
Once you've clicked the icon, then the activated proxy will be indicated like this:
Oh well, hope this helps somebody else.

Resources