Locally working with CNAMEs in multi-tenant apps - dns

I have a multi-tenant app where the user gets a subdomain youraccount.myapp.com that works fine. I have some customers who want to be able to have their own domain that redirects to the subdomain. So something like foobar.com --> youraccount.myapp.com. I'm pretty sure I've got the logic down in my app, but I have no idea how to test this on the DNS CNAME side of things. I don't want to launch this feature without seeing it work locally.
I feel like adding a host entry isn't going to test the logic, but maybe I'm wrong? Anyone know how to test this?

You cannot have any other records together with a CNAME.
Since a "domain name", i.e. a "zone cut" where the parent zone contains NS records pointing to the delegated domain, must have an SOA record (and probably its own copies of the NS records, plus any other relevant and necessary records), it cannot also have a CNAME.
So the only way for the customer's own domain to point to the app subdomain would be for their domain name to also have an A record that points to the same address as the youraccount.myapp.com record points to.
The best they can do is to have their own subdomain that points to your subdomain, e.g. (using your example names):
app.foobar.com. IN CNAME youraccount.myapp.com.

Related

How to setup a subdomain DNS proxy?

Hello I will get a access to a subdomain division.company.com and I will have to name where to point it in contract. I don't want request for contract update because where subdomain has point to every time I need to switch a server.
I am looking to have a top level DNS like control for a subdomain.
a) Do I use some kind of routing/proxy server?
b) Is there a way to have a dynamic DNS assignation (single time minimal configuration on the top level domain side)?
c) Is what I am looking for possible with DDNS providers like https://www.dynu.com/ ?
I tried using dynamic with a test domain but it did not seam to function properly.
On test domain I added CNAME DNS record b.a.com pointing to b.dynamicdns.com and then on dynamic DNS'es DNS records I pointed a CNAME record of www.b.dynamicdns.com to a website's server then on website server side I tried www.b.a.com but it did not seam to work.
Top level domains has to add NS (name server) records for the subdomain pointing to a DNS management provider
https://www.dynu.com/ has and add own domain where subdomain can be entered and configured but other providers should work too.
NS b.a.com NS1.provider.com
NS b.a.com NS2.provider.com
That will delegate subdomains DNS record management to it and will allow for full control of it. Including adding CNAME records pointing to any server.

Different name servers for different subdomains

Let's say I have a website example.com which I bought via a common domain registry nomcheap.com.
I want all traffic to a specific subdomain app.example.com to go to name server ns1.appserver.com so I can serve a specific user app.
I also want all other traffic (www.example.com, hello.example.com, *.example.com, etc.) to go to a different name server from a different provider ns1.squaresites.com so I can serve a general website (think something like a commerce Wordpress site).
None of the name servers are provided by the original domain registry nomcheap.com.
Is this possible? If so, any suggestions on how?
To point a subdomain to a name servers you need to create an NS record for the subdomain:
app.example.com NS ns1.appserver.com
This will make all queries go to ns1.appserver.com
*.example.com NS ns1.squaresites.com
The second record should catch all subdomains that don't have their own records (of any kind).
Delegating name server DNS responses can be done was the answer by #Lanexbg describes.
Realize that chaining your DNS lookups this way adds more time to DNS resolution and adds another potential point of failure in the resolution process. If the parent's name servers are down, they won't able to deliver the NS records to tell the client's resolver to continue the lookup process through a delegated name server.
Consider if using DNS "A" or "CNAME" records at the parent's DNS server would be acceptable alternative.
For more detail on how DNS resolution is delegated see this answer on serverfault.com:
How exactly should I set up DNS to delegate authority for subdomains?

Having trouble configuring custom domains on Xervo

I have a meteor project deployed on Xervo here. I have a domain bought from GoDaddy, ustechland.com. I'm configuring custom domains in my project's administration panel on Xervo.
2
*.ustechland.com means all subdomains of this domain will point to this project. Now when I hit ustechland.com in the address bar, the URL changes to the project URL (https://utl-95476.app.xervo.io), which I don't want to happen.
I have configured CNAME records in my GoDaddy's domain DNS as specified by the Xervo Docs here.
Here is my list of CNAME DNS Records in GoDaddy:
4
Although, the Xervo custom domain docs specify to add two CNAME records, I'm able to add one CNAME record with www subdomain pointing to Joyent Servo in US-East. Another record with naked domain (#) must be added pointing to the same. But I'm not able to add this record as GoDaddy says the record already exists.
Now, is the URL changing because I'm not able to add the CNAME record required? Do try hitting ustechland.com or www.ustechland.com and see the URL change.
And at times, both these URL's take me to 'Future home of something quite cool' page.
I have found several sources that claim that godaddy does not support root cname flattening (which is what you want).
Check out these ideas for how to deal with this.
CNAME Flattening With GoDaddy.
Quora Answer
Good luck!

for Azure websites, do you need to keep the awverify DNS records?

I managed to get my custom subdomain name assigned to my Azure website, following this (very carefully):
link to azure custom domain name instructions
Is it necessary to keep the "awverify" DNS records after the custom domain names linkage has been established?
I deleted the awverify DNS record for the test subdomain, and was able to add another subdomain pointer to my azurewebsites test site.
Maybe I did not wait long enough. Does anyone else have any experience with this, to say one way or the other?
Not sure if I understand the issue you are running into... but the CNAME entry with the 'awverify' subdomain is used to "prove" to Azure that you own that domain when you are wiring up a custom domain name. Once that is established, you no longer need that.

Rails 3 Custom Domains A Record vs CNAME

Could someone explain the difference between an A Record and a CNAME, and what I should be telling my users to do if I am building a site that allows for custom domains to point to a subdomain on my hosted service?
A record... www.rabbot.com -> 123.123.123.123 (ie. an actual IP address)
CNAME record... www.philip.com -> www.rabbot.com (ie. more like an alias)
Your life will be much simpler if you have your users to use a CNAME as they can point their domains to yours. Then if you need to update your server's IP address you can simply update the single A record you have instead of making all your users update their DNS entries.
This is true regardless of what web framework you are using...

Resources