Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is a two part question

PART 1

I have two domains

  1. domain1.com, with a subdomain (sub1.sub2.domain1.com)
  2. domain2.com, with no subdomains.

If I create a CNAME of corp.domain2.com, that points to sub1.sub2.domain1.com

Will that work? or do I need to configure anything from the domain1.com side of things?

PART 2

if sub1.sub2.domain1.com is secured with a wildcard SSL, and someone visits corp.domain2.com which is just a cname for sub1.sub2.domain1.com, will the browser invoke a SSL security warning?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Part 1: Yes. A CNAME is just one record, and it is only configured in one place. It doesn't even have to point to a valid name, but you will then get an error when you try to resolve it.

Part 2: If you open a browser to corp.domain2.com and the certificate says that the name is supposed to be *.domain1.com, then yes, you will get a warning.

You could configure a redirect on your web server to tell everyone coming to corp.domain2.com, that they should visit sub1.sub2.domain1.com instead. But this will only work if they open http://corp.domain2.com/. You will still see a warning if you open the SSL version at https://corp.domain2.com/ though.

share|improve this answer
    
Is there any way to get the name of the original host. For example if you went to corp.domain2.com, and it's really a name for sub1.sub2.domain1.com, how can I get the corp.domain2.com string using php? Would it be a $_SERVER variable? –  mrc0der Nov 8 '12 at 2:03
    
Test it out, @mrc0der. Look at the output of phpinfo() for the name. But yes, you are right. It will be the _SERVER["HTTP_HOST"] variable. Also check this: stackoverflow.com/questions/2297403/http-host-vs-server-name –  chutz Nov 8 '12 at 2:48
    
I have another issue now: I have a sub2.sub1.domain1.com that's a CNAME that points to sub1.domain1.com; I also have a sub3.domain2.com that is a CNAME that points to sub2.sub1.domain1.com; Now though sub2.sub1.domain1.com works fine and shows the content from sub1.domain1.com, but when i go to sub3.domain2.com it shows the content for domain1.com only, now the subdomain. –  mrc0der Nov 10 '12 at 3:12

Part 1

Yes, it will work.

In domain1.com dns, you need something like follow

    sub1.sub2    IN A     "some IP address"

or

    sub1.sub2    IN CNAME "some hostname"

Then in domain2.com, you add the CNAME

    corp         IN CNAME sub1.sub2.domain1.com.

Part 2

There should be no warning, as SSL is IP base. Following link actually answer in details

http://stackoverflow.com/questions/9935229/cname-ssl-certificates

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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