Pointing domain to Heroku application with wildcard - heroku

I have an application where users get their own subdomain, like site1.mysite.example. I would like to allow users to register a custom domain that they can point to to their sub domain but I'm having trouble figuring how to configure Heroku and my DNS settings to allow this.
In my DNS settings for my domain I have a CNAME record setup like so:
Host = *
Value = sites.mysite.example
The value here is an app I have running which will translate the subdomain (site1.mysite.example) to figure out which site to load.
I have a CNAME for mysite.com which points to Heroku's DNS site:
Host = sites.mysite.example
Value = mysite.example.herokudns.com
On the domain I'm testing with I have a CNAME record setup like this:
Host = docs.othersite.example
Value = site1.mysite.example - this is the subdomain they get on my site
But for some reason this is not working. If I register site1.mysite.example as the custom domain in my application and I run dig site1.mysite.example I get the following:
;; ANSWER SECTION:
docs.othersite.example IN CNAME site1.mysite.example
site1.mysite.example IN CNAME sites.mysite.example
sites.mysite.example IN CNAME mysite.example.herokudns.com.
When I try docs.othersite.example in a browser I get Heroku's There's nothing here, yet. page. So it seems like Heroku is not loading up my application. I am guessing this is because I do not have docs.othersite.example registered as a domain in my Heroku application, but I do not want to have to register every custom domain. Also, I do not own these domains so I could not anyway.
What am I doing wrong here? Any help is much appreciated. I'm happy to post any more info someone needs or clarify anything.

Heroku does support wildcard domains, so in this case you could add *.othersite.example to your Heorku app's custom domains.
If you need to support different root domains (othersite2.example, othersite3.example) for each user, there's no easy way to support that. You'd need use Heroku's Platform API to programmatically manage custom domains.

Related

Configure DNS for root domain on Namecheap

Relatively new to coding and was looking for some help on configuring the DNS for a root domain. I've been following this heroku guide on adding a custom root domain and am currently stuck since the guide doesn't have specific rules on if your DNS provider is Namecheap (where I got my domain from).
To clarify, I have the domain gperalta.com and would like it to show the page I made at https://guarded-caverns-49596.herokuapp.com/. The closest I've been to having this work is having Namecheap redirect from gperalta to the herokuapp URL. But I'd like the URL itself to remain as 'gperalta.com' instead of defaulting back to the herokuapp URL.
Namecheap lists a Type, Host, Value, and TTS under their Advanced DNS Section. For reference, here are the options for what you can choose for Type:
A Record
A+ Dynamic DNS Record
AAAA Record
CNAME Record
NS Record
SRV Record
TXT Record
URL Redirect Record
Haven't been able to find anything on Namecheap (closest answer I found involves using an IP address, but heroku doesn't keep a consistent IP for apps) or stackoverflow so far, so any help would be much appreciated.
I hope this helps you get started. https://www.namecheap.com/support/knowledgebase/article.aspx/9737/2208/pointing-a-domain-to-the-heroku-app
In the future, Namecheap has an always-accessible 24/7/365 Live Chat and ticket platform so you should expect to get answers quicker.

Custom Domain With Heroku with a CNAME record - not working

I used the heroku guide to setting up a custom domain to set up a custom domain for a Heroku app, however, the custom CNAME record I set up at Dreamhost isn't working correctly. The website for my app (myappname.com) shows the Heroku page that says "There's nothing here, yet".
Here's what I used per the Heroku guide:
CNAME record at Dreamhost:
record: www
type: CNAME
Value: myappname.com.herokudns.com
In my Heroku settings this is what shows as the target DNS:
myappname.com.herokudns.com
This is my first time setting up a custom domain with Heroku so I'm not sure whats going wrong. I looked at all of the similar questions here and read some guides online too. Should I change the DNS record to "myappname.heroku.com"?
I should note the heroku app is on the free tier so there is no SSL.
For future reference, if anyone else makes the same silly mistake I made, make sure your DNS target at Heroku includes the correct subdomain ('www' in this case).

Media Temple and Heroku CNAME

I am using Media Temple to configure my DNS settings for a domain. I recently launched an application on Heroku and want to set a subdomain of my domain to be the CNAME for the Heroku application. The issue is the DNS editor places a period at the end of the Heroku domain name when I enter it as a CNAME, and Heroku shows an error that this is not a valid domain.
In my DNS settings, I have:
subdomain.domain.com CNAME appname.herokuapp.com
When I save this, it shows up in the settings as
subdomain.domain.com CNAME appname.herokuapp.com.
Any ideas on how to remove that trailing dot?
I ran into this problem the other day when setting up CloudFlare for my Heroku app. "I do not think it means what you think it means."
With Heroku, you have to add domains that your app will be accessible from, even if your managing DNS elsewhere. Here's there documentation for how to do it. Basically, you can do this from the terminal:
cd into your app's directory
heroku domains:add subdomain.domain.com to add the subdomain like you want.
Also, on mediatemple, I think you might need to put just the subdomain part instead of subdomain.domain.com, though it'll probably work either way. As shown on the knowledgebase article from launchrock on adding a CNAME with Media Temple:
"5. In the Name field, enter the part of the address you chose to use for your website with
LaunchRock. For example, if you chose signup.yoursite.com, enter signup in the Name field."

Providing customers with domain aliasing

Currently I have an app which gives my users a custom subdomain.
neat.coolapp.com
However, I want my users to be able to CNAME their personal domain to that website.
ex. hey.neat.com -> neat.coolapp.com
Is this possible on heroku?
Thanks in advance for any insight.
You'll need to add whatever domain the customer wants to use to your application so the correct application on Heroku responds - you could do this either manually (via the heroku control panel) or use the heroku gem within your application to add the domain to your application via some kind of control panel if the customer is able to add their own domains.
In regards to cname's - I would suggest setting up something like proxy.yourwebsite.com as a CNAME to yourapp.heroku.com and then you get your customers to cname their domain to proxy.yourwebsite.com in their DNS config.
When you sign up for Heroku you will get a subdomain like
asdf.heroku.com
If you have a domain like mywebsite.com you can cname mywebsite.com to asdf.heroku.com and you will need to add mywebsite.com to Heroku's custom domain command.
From there I'm not sure, if you wanted to add mywebsite2.com without having to add it using the custom domain command you can try to cname it to mywebsite.com, if you have two domains you can try it out.

MVC3 Url.Abs returns domain at Azure, not the CNAME record at domain registrar

I have a Windows Azure application at http://[some GUID].cloudapp.net.
I have used a CNAME record at GoDaddy to point mydomain.com to this application. Everything works fine but one thing. I send emails from this application and embed links to the site using
#Url.Abs(Url.Action("Action", "Controller"))
Url.Abs always prepends the http://[some GUID].cloudapp.net domain, not mydomain.com. I haven't found an overload to this helper that lets me pull my domain name out of the web.config or something like that. How do I tell MVC3 to use mydomain.com?
I'm confused, because I don't see how the app could possibly know the .cloudapp.net domain. CNAMEs don't work that way... the app would only see "mydomain.com."
Are you sure your CNAME is set up correctly, and it's not just forwarding or "masking" or something?

Resources