I serve multiple websites for my clients on one server. During development I simply make a subdomain on my own domain. Example client.mydomain.example
.
Often my customers already have a domain and email with another provider.
I do not want to host email for my clients.
I have tried three different ways of setting up DNS:
- Make an HTTP redirect from
clientdomain.example
towww.clientdomain.example
and then a CNAME record forwww.clientdomain.exmple
to point to temporary subdomain on my serverclient.mydomain.example
. - Have an A record from
(*.)clientdomain.tld
to my server IP, but leaving MX and such to point to their current email-host. - Set up my own nameservers and use those for my client's domain. Then setup the same way as 2.
As far as I can see there are pros and cons with all three:
- Pros: Convenient. I can change the IP address on my server, move to another serverpark, set up failsafe, load balancing and so on.
Cons: I force my clients to usewww
, and if they already have a site onnon-www
they might suffer SEO-vise(?). Also the extra
CNAME record is bad for page speed. - Pros: No SEO or page-speed issues. Easy setup.
Cons: If I need to change IP, I need to make DNS changes for ALL my client sites. - Pros: No SEO or page-speed issues. If I need to change server, I can do this for all my client sites at once, since DNS settings is conveniently setup on my own name servers.
Cons: I need to run my own name servers. I also have to set up MX records and possibly other DNS records for my customers.
My preferred way right now is 1. since I think the pros outweighs the cons for most of my cases.
Are there any other way to redirect from a domain to a server without specifying the IP-address?
Clarification: Solution 1 works for me, but it is slower because of the two steps before coming to the final A record. Ideally I would want to point both non-www
and www
to my server domain, but as far as I know, this is not possible with a CNAME record, right?
Answer
Please notice, that a CNAME
is not a HTTP redirect at all.
Only redirect here is from the
example.com
towww.example.com
and it can be made permanent. The extraCNAME
is on DNS level and will be cached, so it doesn't really affect the site performance nor speed at all.Your web server needs to be aware of the client domain despite who's hosting the DNS.
That's why I'd prefer your case #1, with a better understanding:
- Guide your client to add
www.example.com. CNAME client.example.net.
to be able to change the IP address on your own, if necessary. - Advise how to make a redirect from non-www to www on their current web server.
- Bind the actual domain name to your
client.example.net
in your webserver's configuration.
With the case #3 you won't just end up technically hosting DNS servers, but also be responsible of doing updates whenever a client needs a new third party record.
No comments:
Post a Comment