CNAME pointing to one FQDN, but taking me to a different one

1

We have an apache server that runs our work Intranet (intranet.domain.com), as well as a test site with restricted access (dummy.domain.com). Both are in DNS and both work when I go to the full address, but I also have a CNAME in DNS (drewnett - points to intranet.domain.com.) and this is connecting to our test site as opposed to our main site.

Through experimenting I found out that drewnett will take you to the location defined in the first config that it finds (so first alphapetically in this case).

I'm lost for what to check, as Apache Configs must be correct for the full address to connect correctly, and my CNAME has a '.' at the end of it.

Any pointers here would be welcome.

David Gard

Posted 2012-02-28T16:45:44.263

Reputation: 1 368

Answers

1

You have to add a ServerAlias for this other hostname.

JohnD

Posted 2012-02-28T16:45:44.263

Reputation: 276

Thans, that sorted it. – David Gard – 2012-02-29T10:11:47.893

1

Extended version of JohnD's answer

When more than one virtualhost exist in Apache and it get request for host, not known to it (through ServerName or ServerAlias), it returns first virtualhost in list.

In order to get dummy.domain.com instead of drewnett, you have to add drewnett as alias for "main" host

Lazy Badger

Posted 2012-02-28T16:45:44.263

Reputation: 3 557

Got it, thanks. I assumed that putting the FQDN against the CNAME would do the trick, but guess it just references that for IP. Thanks again. – David Gard – 2012-02-29T10:11:30.560