Subject: Re: ipf or ipnat
To: None <wojtek@wojtek.from.pl>
From: Kevin P. Neal <kpneal@pobox.com>
List: netbsd-users
Date: 03/19/2001 10:10:34
On Mon, Mar 19, 2001 at 08:16:26AM +0100, wojtek@wojtek.from.pl wrote:
> > Subject: ipf or ipnat
> > 
> > Is there is a way I can redirect websites?
> > For example user on 192.168.0.16 tries to open www.microsoft.com
> > But I want to open www.netbsd.org on his computer instead www.microsoft.com
> > Can anyone tell me how would I do that?
> the easiest way is to define in your named.conf domain
> "www.microsoft.com" with entry @ IN A <www.netbsd.org IP>

Well, yes, but that would be wrong.

One of the headers went as part of the HTTP protocol is a line naming the
host the browser wants to access. This is to allow for multiple virtual
hosts on the same IP address. If you simply add the A record as you suggest
then the browser will ask www.netbsd.org for www.microsoft.com's virtual
host. 

Configuring a web server (Apache specifically) to behave sanely when given
a request for a virtual host that server does not serve is tricky. It is also
impossible to get right in all cases if multiple sites are served from
that server.

Basically, "don't do that".

I suggested rewriting the URL and host header in a proxy for a reason.
-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/
           On the community of supercomputer fans:
"But what we lack in size we make up for in eccentricity." 
  from Steve Gombosi, comp.sys.super, 31 Jul 2000 11:22:43 -0600