Put client domain in my domain

I have a site with subdomains for my clients (substitution subdomain)

client1.test.com client2.test.com 

I want my clients to use their domain. If they want to.

which record should be added to the point

 client1.com => client1.test.com shop.client1.com => client1.test.com 

I use the free cloudflare plan for www.test.com, but I am open to change it if it is impossible to do

+7
dns wildcard-subdomain cloudflare
source share
4 answers

CNAME records will work for this. You can also use A records to specify the same IP address as test.com

+5
source share

You need to change cname to redirect the IP address of your client1 to your domain provider at client1.test.com

You need to change cname to redirect the client2 IP address to your provider domain on client2.test.com

Configuring CNAME on a cloud flash is for paid plans only

https://support.cloudflare.com/hc/en-us/articles/200168706-How-do-I-do-CNAME-setup-

You can also check https://support.cloudflare.com/hc/en-us/articles/200168826-Does-Cloudflare-support-wildcard-DNS-entries-

+3
source share

You just need to understand the DNS records and how they work. You can find a good resource for here , the most important of which is the β€œRecord” in your case.

However, before your customers can point their own domain to your system, they will have to set up their domain host entries by pointing to your server / IP address.

For you, you do not need to do anything in Cloudflare, but on your server. Let's say you set up your web server for recognizing client1.test.com, but client1 decides to use the client1.com and shop.client1.com domains, you must install your web server block for client1.test.com to recognize these two domain aliases in addition to the original subdomain.

With Nginx, it will look like this:

 Server { ... ServerName client1.test.com shop.client1.com client1.com ... 

You can look at this script if you are looking for how to automate this process.

+3
source share

Perhaps you could use a CNAME record as follows:

 client1.com CNAME client1.test.com. shop.client1.com CNAME client1.test.com. 

The point at the end is to tell DNS not to populate your entry with the default domain name.

If you should not use DNS for forwarding, you can also use it, even if possible, by forwarding IPTables. Good in this solution ... you can decide which port will point to which ip ... so you can redirect the web server to your Client's Server, but leave Mail on your server (for example)

Here's how to redirect a port to another host with an external IP address:

 sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport $port -j LOG --log-prefix="PreRouting $port..:" sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport $port -j DNAT --to $ip:$port sudo iptables -t nat -A POSTROUTING -j MASQUERADE sudo iptables -A FORWARD -p tcp -i eth0 -o eth0 -s $ip --sport $port -j LOG --log-prefix="S Forward $port.." sudo iptables -A FORWARD -p tcp -i eth0 -o eth0 -s $ip --sport $port -j ACCEPT sudo iptables -A FORWARD -p tcp -i eth0 -o eth0 -d $ip --dport $port -j LOG --log-prefix="D Forward $port.." sudo iptables -A FORWARD -p tcp -i eth0 -o eth0 -d $ip --dport $port -j ACCEPT 

You also need to add this command to install on the network stack:

 sudo sysctl -w net.ipv4.ip_forward=1 

This will work in the default DENY IPTables setting.

+1
source share

All Articles