[Pdns-users] Cnames?

Derrik Pates demon at devrandom.net
Sat Jan 14 18:47:37 UTC 2006


Ken Scott wrote:
> I've been runing pdns for about two years to run my web sites,
> and I'm wondering, what sort of urls can I forward with CNAME?

A CNAME record doesn't work like you seem to be thinking. CNAME records
point one DNS entity name to another, and all services will refer to the
new name, as this is processed at the resolver level.

> I thought that I could use cname to forward any url, like
> www.domain.com?page=home&id=5 <http://www.domain.com/?page=home&id=5> ,
> but the server doesn't seem to be responding to this.

You could point www.foo.com to www.bar.com (which wouldn't really work
with name-based virtual hosts, unless www.bar.com was added as an
alias), but you can't use a CNAME to redirect to
www.bar.com/foo/script.php or similar. You would need to use URL records
for this - that requires setting 'urlredirector=' to the IP address of a
web server that's appropriately configured (probably running on the
nameserver) to direct all queries to a custom script to do the
appropriate lookups. It's not hard to write such a script in PHP or
Perl, and most any web server can be used (I use lighttpd + php4-cgi
with fastcgi).

-- 
Derrik Pates
demon at devrandom.net


More information about the Pdns-users mailing list