natd & virtual hosting

Matthew Seaman m.seaman at infracaninophile.co.uk
Wed Mar 24 03:02:15 PST 2004


On Wed, Mar 24, 2004 at 01:42:43AM +0100, Torfinn Ingolfsen wrote:
> On Tue, 23 Mar 2004 16:12:08 -0800
> "Eli K. Breen" <eli at gopostal.ca> wrote:
> 
> > Just to wrap up this thread (although it has left the realm of 
> > FreeBSD-specific)
> > 
> > This worked perfectly! (Apache2 only)
> [.. lots of info about the Proxy module snipped...]
> 
> I don't know if this is 1.3 specific, but I use this solution with
> Apache 1.3.x:
> <VirtualHost *>
>     ServerName somename.domain.example
>     RewriteEngine on
>     RewriteRule ^/$     http://server/     [P]
> </VirtualHost>
> 
> where 'server' is a dns-resolvable name (or ip address).
> In another, the RewriteRule line looks like this:
>     rewriteRule (.*)    http://192.168.1.1/$1  [P]
> at the moment, I can't remember why this one is different.
> 
> Also, I can't remember where I first found this mentioned (except that
> it is documented at the Apache web site).

Yes -- that would work too.  TIMTOWTDI. However, with mod_rewrite
you've got to be careful with those [P] flags on the rewrite rules, or
you'll just end up issuing a 302 redirect -- and that wouldn't work
for the problem the OP had.

In fact, mod_rewrite [P] rules are handed off to mod_proxy to deal
with: mixing up mod_rewrite and mod_proxy in this way gives you a lot
more control over what URLs you select for this sort of proxy
remapping, but it's probably overkill for simply remapping whole
virtual hosts onto a different server.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20040324/a1d78959/attachment.bin


More information about the freebsd-stable mailing list