Skip Menu |

This queue is for tickets about the HTTP-Proxy CPAN distribution.

Report information
The Basics
Id: 19098
Status: open
Priority: 0/
Queue: HTTP-Proxy

People
Owner: book [...] cpan.org
Requestors: lunch [...] ifrance.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Cannot select source address to use for outgoing connection
On my machine, I have two different interfaces connected to the Internet. It seems that HTTP::Proxy always use the default interface and I can't find a way to tell it which address I want it to bind to. A useful option would be something like Squid's "tcp_outgoing_address".
On Fri May 05 08:06:48 2006, guest wrote: Show quoted text
> On my machine, I have two different interfaces connected to the > Internet. It seems that HTTP::Proxy always use the default interface
and Show quoted text
> I can't find a way to tell it which address I want it to bind to. A > useful option would be something like Squid's "tcp_outgoing_address".
The listening address is controled by the "host" parameter (which defaults to "localhost"). For the outgoing connection (from proxy to origin server), this is handled by LWP::UserAgent. I do not think that LWP::UserAgent lets one decide which interface is used. So, unless there is a way I don't know to enforce this in LWP::UserAgent, I'm afraid there is no way to support such a parameter.
From: damien.norris [...] gmail.com
On Fri May 05 09:18:12 2006, BOOK wrote: Show quoted text
> For the outgoing connection (from proxy to origin server), this is > handled by LWP::UserAgent. I do not think that LWP::UserAgent lets > one decide which interface is used. > > So, unless there is a way I don't know to enforce this in > LWP::UserAgent, I'm afraid there is no way to support such > a parameter.
Hello! I had exactly this issue, because I was setting up multiple HTTP::Proxy processes to listen on each of 5 IP addresses. Then I wanted each of the 5 to go out its own IP address... e.g.: ./proxy.pl host 10.0.0.1 & ./proxy.pl host 10.0.0.2 & ./proxy.pl host 10.0.0.3 & But, outoging connections always came out through 10.0.0.1 (the primary netowrk interface). I was easily able to solve it by modifying HTTP/Proxy.pm and adding: local-address => $self->host to sub _init_agent, like so: sub _init_agent { my $self = shift; my $agent = LWP::UserAgent->new( env_proxy => 1, keep_alive => 2, parse_head => 0, #add local_address so the proxy goes out the IP that is bound to, and not just the default local_address => $self->host, timeout => $self->timeout, ) or die "Cannot initialize proxy agent: $!"; $self->agent($agent); return $agent; } Hopefully that helps!