We're having problem with a server config, and I hope I can get some help with this as its driving us mad!

Basically, we have an app set up at domain.com, and wildcard subdomains set up on the same domain, for users. We want to implement custom domains for users the same way tumblr does it for instance, so that the user creates a CNAME to his subdomain, for instance :

userdomain.com  -> CNAME -> user.ourapp.com

After setting this up for one user though, his domain just routes to a server default page on our end. After getting in touch with plesk the response was this :

According to internal web servers logics, name based hosting works using hostname in HTTP header. Using only CNAME record in DNS will not work, due to DNS return us only new-server IP, and browser will go to that IP, but an old-server name still remains in HTTP headers.

And web-server after receiving such a request will work as it should, it will unsuccessfully try to find userdomain.com and open default virtual host, in our case Media Temple Server page.

Ok, cool. So we went to edit our config slightly. We're running Plesk 10.4, and under the wildcard subdomain we have a httpd.include file for vhosts.

In there we have this :

    ServerName "_.ourapp.com:80"
    ServerAlias  "*.ourapp.com"
    UseCanonicalName Off


Now, we tried removing the ServerName and just keeping the Alias, and using /etc/init.d/httpd reload to reload the config, but we're still getting a Default Server Page.

We're stumped.

Has anyone had experience with this problem before, and is there a solution?

Thanks in advance, Warren


The browser will still send a Host: userdomain.com header, the CNAME record will not cause a redirect. You will therefore need ServerAlias userdomain.com in your configuration. It is in your application that you will need to associate userdomain.com to the user.

  • We're looking for a more dynamic solution though, where we dont have to manually add a ServerAlias each time we have a user. Tumblr does this with CNAMEs somehow. What about a catch all vhost and get the user to set up an A record to an ip on our end? Jun 20 '12 at 10:08
  • 1
    You already have your catch-all vhost, it apparently shows your "Default Server Page". Just put your application there and it will catch all requests that arrive at your server. For the browser it is irrelevant if you use CNAME or A records. It will always send the host name the user entered into the address field.
    – Oliver
    Jun 20 '12 at 11:08
  • Awesome. The only problem I can see is that we have 2 apps that need this functionality. We have no problem setting up a IP for each. Is there a default server page area for each, or do we need to alter the catch all for each domain and add the document root for each to where each app is now? Jun 20 '12 at 11:47
  • I think you could create a dispatcher application then, which redirects users to the respective application? Suppose that user1.com is subscribed to app1. If a request with Host: user1.com arrives at the dispatcher, you could e.g. redirect it to user1.app1.com, which would be a virtual host on your server. But, honestly, a distict IP address for each application wouldn't be too bad.
    – Oliver
    Jun 20 '12 at 12:34

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.