01 #!/usr/local/bin/perl -w 02 use strict; 03 use HTTP::Proxy; 04 use HTTP::Proxy::HeaderFilter::simple; 05 use HTTP::Request::Common; 06 07 my $proxy = HTTP::Proxy->new( 08 host => "192.168.1.123", 09 port => 9999 ); 10 11 my $repl = "http://perlmeister.com/test/" . 12 "sandy-beach.jpg"; 13 14 $proxy->push_filter( 15 request => 16 HTTP::Proxy::HeaderFilter::simple->new( 17 sub { 18 my( $self, $headers, $req ) = @_; 19 20 if( $req->uri() =~ 21 /eviladserver\.com/ ) { 22 $_[2] = GET $repl; 23 } 24 } 25 ) 26 ); 27 28 $proxy->start;