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.

How do I resolve a subdomain to another subdomain of a different host? What I need is

sub.firstdomain.com

to be resolved as

sub2.seconddomain.com

I do not have control on secondomain.com(it is a cloud hosting) but I own firstdomain.com

I cannot make CNAME to point to IP as I cannot resolve the IP of the subdomain.

I used CNAME record BUT it gives me 404 error so I think the forwarding is correct but something is wrong.

So, what can I do? Is there a CNAME tweek? or tip? Is there another way other than CNAME?

share|improve this question
add comment

1 Answer

  • You can't point a CNAME to an IP-Address only to another A record
  • You are confusing HTTP Host headers and DNS entries

To explain the second part:

If i set up a VirtualHost that reacts to firstdomain.invalid on 192.0.2.1 but don't create a DNS entry I am still able to browse the site by adding the Host headers manually and requestfing from http://192.0.2.1.

If I now crate a DNS entry firstdomain.invalid A 192.0.2.1 I can browse the site by simply using the name (since the HTTP client will take care of the situation that a Host header is needed)

If someone crates a DNS entry seconddomain.invalid A 192.0.2.1 nothing will happen with a browser since the server doesn't know abut the corresponding host entry (setting aside default hosts for now)

If someone creates a DNS entry seconddomain.invalid CNAME firstdomain.invalid the same is true as the above. PLUS the owner of seconddomain.invalid will run into Mail problems since any sane client will see a CNAME entry and start resolvoing the MX entries under the domain where seconddomain.invalid points to. In other words: the programs will do this:

Hey there's a CNAME from seconddomain.invalid. It's pointing to firstdomain.invalid. Great I'll just take the MX of firstdomain.invalid since it's a CNAME and try mailing to whatever host is defined there as an MX, if there's no MX defined I'll simply try to mail to the A record of firstdomain.invalid

PS (and totally OT): The .invalid Domain and 192.0.2.0/24 are reserved for documentation and example purposes. Please use those as they are guranteed (by RFC) not to be reachable

share|improve this answer
    
Hi and thanks for the reply, but there is no real solution there? what can i do?thanks –  Joseph Jul 4 '11 at 0:12
    
The people who own the content HTTP server have decided that it does not carry the domain second.example.com. and have configured it accordingly for the case where anyone goes there asking for WWW pages whose URLs use that domain. You tell us that you don't own the content HTTP server. There is nothing that you can do to affect a content HTTP server that isn't yours to reconfigure. –  JdeBP Jul 4 '11 at 14:27
    
That is not totally true, you could always use an application layer proxz (read squid) to provide the simple case. Of course you could always hack something up to rewrite the content so it looks like your own -- but that would be...unethical –  Server Horror Jul 4 '11 at 20:48
add comment

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.