Programmatically Connect domains to servers - dns

I want to create a simple web app. where user can have a form to add domain and directory name( that is already created on our server ). And it simply starts pointing the domain to that directory. What apis should I need for this? Hosting and domains can be bought from same brand, like GoDady.

Cloudflare has an API to add DNS records.
However, if you go this route, these are the prerequisites:
User's domain must already be activated in Cloudflare. At least partial-setup with Cloudflare's hosting partner (Siteground etc which have Cloudflare integrations built-in) or full-setup (the domain's authoritative nameserver points to Cloudflare).
User must trust you with their email address linked to their Cloudflare account and their Global API key.
Your web app can then make the API call to the endpoint and Cloudflare will create the appropriate DNS records to point to your server.

Related

Remove DNS authorization for IP address in Azure

I have a couple of web applications on an Azure server. A client allowed the domain to lapse, and I can no longer access the DNS settings for this domain. The domain's DNS settings (A records, CNAMES) are still authorized in Azure to control traffic for the server's IP address. So, any app I create on this server now resolves to the domain that is no longer under my control.
How do I get myself out of this pickle? Can I change the server's IP address? I have not been able to find out how to do that. Can I de-authorize the DNS settings that now control access to this IP address?
If you want to remove access to the app from a domain, you just remove the domain from the App Service.
DNS tells users where to go for a particular domain name.
If your app doesn't mention it as a domain, the request won't be routed to it.
Remember that addresses in Azure App Service are shared so it requires that you actually explicitly mention the domain in the app service's configuration.
Ugh. Ok, my issue was that I was redirecting to the domain in my web.config.

Changing my shared hosting nameservers to cloudflare nameservers

I have signed up with cloudflare and i am running a website on shared hosting. I changed the nameservers of my domain on the shared hosting. I was expecting the website to not be available since i changed the nameservers but that has not happened yet.
I plan on confirming my domain on mailgun and having business email with google g-suite which both require i update srv settings in my domain.
My question is, why is my website still not offline and will the g-suite and mailgun changes be now done on the domain control panel or from cloudflare?.
If you changed the records at your registrar to connect to cloudflare, and then provide the appropriate A (or combination of A and CNAME) records in cloudflare you will be able to connect properly to your shared hosting and manage DNS records like SRV directly at cloudflare.

Client cname pointing to my domain on cloudflare

A client of ours has the domain client.com
Our application is at superapp.mycompany.com
We want the client to be able to access our application via their own subdomain, like: superapp.client.com.
Normally we'd just tell the client to add a cname for superapp and point it to superapp.mycompany.com. Then on our server (IIS) we'd bind their domain to our app and everything would work as intended.
However, we can't replicate this functionality when our mycompany.com domain is managed via cloudflare.
When we navigate to superapp.client.com we get the following error page:
Error 1001
What happened?
You've requested a page on a website (superapp.client.com) that is on the Cloudflare network. Cloudflare is currently unable to resolve your requested domain (superapp.client.com).
Is there any way that Cloudflare can be used in this fashion?, this seems like a pretty standard set up for a multi tenant application that supports custom domains.
We don't need all the protection that Cloudfront offers for these client domains, but we want to use the Cloudfront nameservers for out application (mainly for fast switching of DNS records in the event we migrate servers, etc).
Any help is appreciated.
I hope it's not too late. But just found a way to do so.
You just need to add your client's domain (Add site in Cloudflare) to your account.
You don't need to change client domain's NS. So in your Cloudflare panel this domain will showing as "Pending Nameserver Update".
Next step is add the CName record to this domain.
Although the NS of client domain is not changed to CF, but CF has a lookup record as CName for it.
Hope it helps.
Just in case someone arrived here with same issue as me. Here is the answer. For short, no that won't work.
Since Cloudflare is a reverse proxy for the domain that is on Cloudflare, the CNAME redirect for the domain (not on Cloudflare) wouldn't know where to send the traffic to.
Ref: https://support.cloudflare.com/hc/en-us/articles/360017421192-Cloudflare-DNS-FAQ#CloudflareDNSFAQ-CanICNAMEadomainnotonCloudflaretoadomainthatisonCloudflare
If you don't need the CDN benefits, you can still use Cloudflare nameservers to manage your DNS zone and keep your current configuration. Just make sure the CDN is deactivated for the target subdomain in your zone (superapp.mycompany.com in your case).
You can tell if the CDN is activated or deactivated for a subdomain by looking at the cloud icon on the right of each DNS entry: if the cloud is orange the CDN is active, if it is gray, it isn't.
Cloudflare also supports external CNAME resolution in their CDN infrastructure, but it's only available for its Enterprise customers:
https://support.cloudflare.com/hc/en-us/articles/217371987-Managed-CNAME

How to direct all newly registered domains to default holding page

When you register a domain with, let's say GoDaddy, and use their nameserver your domains points to a default holding page.
I run my own nameserver and when I register new domains I point my domains to my own DNS.
How do I set up a holding page so that all newly registered domains point to a default holding page.
Any pointers will be helpful.
Tx
I believe what you are asking is that you want to be able to purchase a domain, update it's nameservers to point to your DNS server and then have a default webpage "holding page" for them?
You can do this, but you will need to configure DNS. DNS servers, by default, do not give out answers that they do not know the answer to. There is a mechanism called dns hijacking, but it is very frowned upon. So lets assume that for every newly purchased domain you do configure DNS. To create the "holding page" simply point your default records (domain, www.domain, etc). to a web server's ip address.
On the web server do not use virtual hosts. A virtual host will give a specific web folder to a request with a given host header. This means that if you request foo.com you will get the foo.com folder. If you request bar.com you will get bar.com folder, etc. If you do not configure your webserver for virtualhosts then the web server will simply return the default web folder.

automatic sub-domain registration

I'm new at DNS world, did some readings in the Internet and wanted to know if I came to the right conclusions. I want to build a system where users are able to create new sub-domains of existing registered domains automatically:
My system provides services to different companies, these services are hosted in my system or some cloud provider. Lets call my system "services" and some company "company1". I want to offer "company1" my services and have its users access these services through "company1" new sub-domain, when "company1" has an already registered domain company1.com. I want "company1" admin user be able to control and choose the sub-domain via my system when he registers his company in my system, and have the whole thing automatic. If i understand correctly:
if the admin would want to use a sub-domain like services.company1.com this will be a problem since I would need to update the authoritative name-servers of company1.com which I don't know who they are, and even if I have a way to know them (and from reading a bit I see that I do have a way), I don't know if every such name server will allow such updates from some external source, connectivity issues etc
if the admin would like to use a sub-domain like company1.services.com then I can achieve this by having my own dns server which I will register the services.com domain for and actually manage all these company sub-domains in my own dns server. This means though that all companies will have to have a sub-domain under my domain services.com
Please correct me if I have a wrong view on how DNS works.
thanks!
services.company1.com
To provide this kind of domain name to your customer, you will need their collaboration. A lot of companies provides this kind of feature by asking you to point an alias (CNAME Record) to a specific server.
Examples of concrete usage
blog.company1.com. 3600 IN CNAME domains.tumblr.com.
shop.company1.com. 3600 IN CNAME myapp.herokuapp.com.
git.company1.com. 3600 IN CNAME bitbucket.org.
Here's some links to the documentation of companies offering this feature:
BitBucket
Heroku
Tumblr
Sample client zone file
So in your case your customer DNS zone will contain something like that:
services.company1.com. 3600 IN CNAME domains.services.com.
where domains.services.com. will be the server that handles the subdomain authentication
company1.services.com
To provide to your customers company1.services.com, you don't have to manage your own DNS server, you just have to be able to add a wildcard record to point all the subdomains to your application. It will be the role of your application to filter your service per subdomains.
Sample service zone file
For example (where 0.0.0.0 is your service IP address):
*.services.com. 3600 IN A 0.0.0.0

Resources