Heroku custom domain with Godaddy - heroku

I have a heroku app set up on a .app TLD, and a custom domain through GoDaddy.
What I would like is to have something like this:
myapp.example.com resolves to my app, and does not redirect.
What I am currently experiencing is:
myapp.example.com redirects (with a 307) to my-example-app.herokuapp.com
What I have done:
Following the Heroku guide for custom domains, I've done heroku domains:add myapp.example.com -a my-example-app and also added a cname to though the Godaddy UI for my domain.
CNAME myapp some-heroku-dns-somehash.herokudns.com
Any help, advice or pointers would be appreciated.
Edit: The 307 redirect is just due to the app redirecting to /sign-in. The issue that I am trying to resolve is using the custom domain, and not the heroku domain.

The 307 redirect is just due to the app redirecting to /sign-in.
This causes me to think that your application thinks it should build URLs using the Heroku domain instead of the custom domain.
Does your application have a place where its domain is configured? You might just need to update that setting so it can build own URLs using the proper domain.

Related

masking heroku app from godaddy using cloudflare

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 site at example.com 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?
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.

How to redirect my naked domain to https://www.mywebsite.com with Google Domains and Heroku?

I host my website on heroku and my domain is managed by google domains.
I have successfully linked my domain to my heroku app. However, to go to my website, people are forced to type the exact domain www.mywebsite.com . If someone just type mywebsite.com there is an http error.
I'm searching on both google & heroku docs but i don't find anything related to this . All info i found are about subdomains.
Any idea for redirecting all http/www typo to my www.mywebsite.com ?
At the core, keep in mind that example.com and www.example.com are 2 different hosts that can resolve to different IPs. Your DNS settings at Google Domains handles this. Either direct both of them to Heroku or simply direct "www" to Heroku via the CNAME record that they give you and then use Google Domains forwarding feature to forward all non-www traffic to www.example.com.
In the Synthetic records, choose Subdomain forward, fill # in Subdomain, then www.yourdomain.com in the Destination URL, also choose Forward path and then ADD

use both www and naked domain to point my heroku app

I am having trouble to set both my www.domain.org and domain.org to point to Heroku rails app.
I did a CNAME from www to www.example.org.herokudns.com.
it works fine and my www.example.org point to my example.herokuapp.com
Concerning https://example.org
Should I do a
CNAME from # to example.herokudns.com ?
ALIAS is only accepted for IPs with my domain provider..
I having trouble finding an answer in stackoverflow.
Should I use http://wwwizer.com/naked-domain-redirect ?
Do I have a solution without using a third party free service ?
For naked domain example.com you can use the forwarding functionality. If you have purchased domain from GoDaddy you can follow this:
Go to manage DNS and scroll down to forwarding section where you will see something like this:
You can choose https and forward to www.example.com. (You can also make your naked domain point to some other subdomain)
heroku domains:add example.com
heroku domains:add www.example.com
heroku domains:add *.example.com
This is to point your domain name from heroku side
Here is a youtube video to make it easier https://www.youtube.com/watch?v=kKGSGT7mSnQ&t=29s
Please let me know if this does work

Prevent heroku to redirect from http to https on subdomain

I have an app created on Heroku and I added subdomain to it:
some.page.example.com
www.some.page.example.com
Then, according to this, I've pointed these names to proper Heroku names with my DNS provider like this:
some.page.example.com CNAME some.page.example.com.herokudns.com
www.some.page.example.com CNAME www.some.page.example.com.herokudns.com
I'd like to serve this page under http, apparently Heroku internally redirects traffic to https - it returns 301 when trying to access page via http. Of course finally it fails (e.g. ERR_SSL_PROTOCOL_ERROR in Chrome or SSL_ERROR_INTERNAL_ERROR_ALERT in Firefox), after redirecting, beacuse there is no certificate set up on this Heroku app.
How can I prevent Heroku from doing this?
P.S. What's funny, I have other site on Heroku, with root domain pointing to this, and it works like a charm. :/

How to setup a root domain redirect for https with google domains

Using Google Domains, I've set up a synthetic record to redirect foo.com -> www.foo.com. Just like in this example:
https://support.google.com/domains/answer/6346300?hl=en
However, it doesn't seem to work with https://foo.com.
How do I configure it so that the subdomain forward works with https as well?
To give it more context, I'm mapping my custom domain to a heroku app, so I've set up a CNAME record for www.foo.com, and would like https://foo.com to be mapped to https://www.foo.com
Before providing any input please confirm if you are using any pointing service?
If http://foo.com is working whereas https://foo.com is not then you may need any service like pointDNS or cloudflare.

Resources