www-modproxy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Birkett <richard-apa...@musicbox.net>
Subject Re: proxy with a specific source IP?
Date Sat, 05 Jun 2004 16:31:15 GMT
On Thu, 29 Apr 2004 at 13:44 -0700, Geff wrote:

> I've done quite a bit of reading looking for config options to do what I want
> and I haven't found anything.  Do any of you know if something like this can be
> done, or if I should try to write "hack/patch".

I've just submitted (as 'bug' 29404) a patch I've been using successfully 
for a few years now.

There was also a brief discussion on this list back in November, with a 
partial patch which changed the proxy source address to be the same as the 
enclosing VirtualHost's listen address.

My patch adds a new per-VirtualHost configuration directive 
ProxySourceAddress, which takes a single IP address.  This needs to be an 
existing interface address on the local machine, of course, otherwise the 
bind() call will fail.  It'll accept any format understood by 
apr_sockaddr_info_get(), including a hostname, although that's probably to 
be discouraged for performance reasons if nothing else (and it may not do 
what you expect if a hostname resolves to more than one IP address!).

> Given a proxy server with 4 IPs:
> A - VirtualHost1
> B - VirtualHost2
> C - SourceIP1
> D - SourceIP2
> And two destination servers:
> E - Dest1
> F - Dest2
> And given a proxy config that listens on A and B and proxies to E and F, I would
> like the connection to the destination servers (E & F) to be placed from IPs C
> and D respectfully.  Is that possible?

With the patch, your setup could be configured as follows:

    <VirtualHost A>
       ProxySourceAddress C
       ProxyPass / http://E/

    <VirtualHost B>
       ProxySourceAddress D
       ProxyPass / http://F/

Share+enjoy :)


View raw message