0
votes

I am building a Saas Application.

In it, there are multiple user accounts, who will be accessing the application from their own domains.

They will link their domains to my root domain where the application is installed, using CNAME records.

When a user registers, they are asked to enter their domain name. We need to create a new Alias for enabling the CNAME Record programmatically using PHP.

Is there any way to do it?

Edit

Each client of the application needs to access the application via their domains (a custom domain that client owns) which are pointed to our domain (the base domain of the application)using CNAME record in their DNS records.

How can I programmatically bind the custom domain supplied by the client with my hosting account from PHP? Say adding of Parked domain or Domain Alias from PHP code.

1

1 Answers

1
votes

Yes, but how you do it depends on your DNS server - and you told us nothing about that. With Bind (for example) it's just a matter of updating the zone files and reloading the config. With Active Directory, an LDIF call. However what you propose is completely unworkable in practice and also unnecessary.

You cannot start serving DNS for a zone you don't already control.

Nobody in their right mind is going to open up their DNS to give you programmatic access.

I also said its unnecessary - all the DNS does is point traffic to your service. So it doesn't matter if you configure the DNS or someone else does. Each HTTP[S] request coming in bears the domain name - so your service can easily apply the relevant branding / billing / data multiplexing required.

Sorting out how you provision SSL certificates is a much more complicated problem than DNS. Again the business of setting up the data and configuring it is trivial, but you need to prove to a third party (the certificate authority) that you are the legal entity described by the certificate (which you are not).

Hence your options are:

1) Get your client to configure the DNS CNAME pointing to your service name and provide you with the certificate

2) you provision a DNS CNAME and SSL certificate as ${client}.${yourdomain}

3) ask your clients to proxy the request