[Pdns-users] Fancy-records and urlredirector

A/S ScanNet - Dan Faerch dan at scannet.dk
Tue Jun 10 07:52:16 UTC 2003


Hi Dean

>Apache bound to 127.0.0.1 on the PDNS server and using mod_rewrite or
Im not sure if this is what you mean, but if you bind Apache to listen on
127.0.0.1 nothing will work since the http-request from the internet is not
recieved on the 'loopback' interface.. Apache has to listen on an "internet
bound" interface..

If that WASNT what you meant, please completely ignore the prevouis ;)

> something? If anyone has done this and/or has any tips/pointers/links,
they
Im not sure if you can make it work with mod_rewrite.. You have to look into
the database everytime someone requests a domainname..
Pesonally we use a PHP script to do the trick..

The script we use is rather large and extensive, but, i'll whip up a short
example for you in php:
<?
$host_header = mysql_escape_string($_SERVER[HTTP_HOST]);

//Connect to DB
$dbconnect     = mysql_connect('my.dns-sql.com','user','pass');

//Get data from DB
$sql = "SELECT content FROM `records` WHERE `type` LIKE 'URL' AND `name`
LIKE '$host_header'";
$res = mysql_db_query('MyPowerDnsDB', $sql, $dbconnect);
list($destination) = mysql_fetch_array($res);

header("Location: $destination");
?>

I didnt acctually test the script, but it should work.. You can add alot of
fancy stuff like adding the entire request-URI to the $destination.. But
this is as simple as it gets :)..
put this script as index.php in the default web of your apache.. You can
also change the 404 apache error to point  to this document (or mod_rewrite
it)..
(There's no end to the possibillites ;))

Greetings
- Dan Faerch
A/S ScanNet

----- Original Message -----
From: "Dean Mills" <misterd at shaw.ca>
To: "Pdns-Users" <pdns-users at mailman.powerdns.com>
Sent: Tuesday, June 10, 2003 7:37 AM
Subject: [Pdns-users] Fancy-records and urlredirector


> Was wondering if anyone is currently using the urlredirector confi option
> with PDNS? I've got a number of HTTP servers behind the PDNS server that
> each contain different domains so was thinking of using it, perhaps with
> Apache bound to 127.0.0.1 on the PDNS server and using mod_rewrite or
> something? If anyone has done this and/or has any tips/pointers/links,
they
> would be greatly aprpeciated!
>
> D.Mills
>
> _______________________________________________
> Pdns-users mailing list
> Pdns-users at mailman.powerdns.com
> http://mailman.powerdns.com/mailman/listinfo/pdns-users
>
>



More information about the Pdns-users mailing list