0

I am by no means a pro in terms of networking and DNS stuff, but I know my share of stuff.

I am attempting to do the following. A customer's hosting doesn't have enough space and permissions to host a small site I am working on. So I am hosting the site on my own server. I want the final URL to be with the client's domain though. So what I did was create a CNAME on my client's hosting, pointing to a new subdomain on my server. Something like:

My subdomain: client.myhosting.com
CNAME on client's hosting: register.clientdomain.com -> client.myhosting.com

The pointing works fine but when I open register.clientdomain.com instead of getting the content of client.myhosting.com I get the root folder of myhosting.com.

I've used this way of masking URLs with services like Instapage and Shopify, so I thought it would only make sense if I did it with a subdomain.

I've been in contact with the support guys from my hosting service, but I am not sure if they are not quite understanding me, if they don't know how to do this, or if I am wrong and it can't be done.

Am I missing some extra configuration or my host's not correctly configured?

[edit: comment on first response given indicates that this is cPanel and the question is thus how to configure a virtualhost alias using cPanel]

2
  • You missed the part where you configure the webserver how to respond to your client's address. It only knows how to respond to yours. – user143703 May 25 '18 at 23:13
  • What configurations would those be @yoonix – Mihail Minkov May 25 '18 at 23:17
1

The hostname used in the URL is sent to the web-server to help it select the right content (virtual-hosting) and CNAMEs just help the clients (web-browsers or whatever) find the IP address(es) of the web-server, they don't change what's sent.

So the web-server needs to be configured to know which domains it should be serving that content for. The register.clientdomain.com example above needs to be added as a "vhost alias" to the virtual host which holds the content.

Do not configure the web-server to return the content for any hostname it's accessed with, that way lies a security nightmare (as your content becomes accessible with a domain-name under an attacker's control, potentially allowing exfiltration of sensitive data). Just add the individual known/allowed server-names.

4
  • So, in this case I am using cPanel, should I add the domain as an addon domain or what should I do? – Mihail Minkov May 25 '18 at 23:16
  • I don't know cPanel at all, but I've edited the tags on your question so that you'll be more likely to get help from people who do. – Phil P May 25 '18 at 23:19
  • Let me check if I manage to do it and I'll get back to you. – Mihail Minkov May 25 '18 at 23:25
  • What finally got the job doing was an addon domain, I thought it wouldn't work since it's a subdomain technically, but it finally did work. You guided me the right way. Thanks! – Mihail Minkov May 29 '18 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.