use HTTP::Daemon; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $d = HTTP::Daemon->new( LocalHost => "localhost", # remove this to listen from other machines # (i.e. open-relay... be careful of spammers!) LocalPort => 8888 #always best to run 'netstat -ano | find "8888"' prior to running this command (to find an unused port) ) || die; #after this program is launched run again 'netstat -ano | find "8888"' to confirm this port is now being bound to this program #then to actually use this with a browser must go to browsers proxy setting (a global windows setting): set server=127.0.0.1 port=8888 #main 'accept-getrequest-process' loop is the next two lines while (my $c = $d->accept) { while (my $request = $c->get_request) { #we wish to send the web client browser a redirect to a local file on his same machine #as a test of the nifty 'send_redirect' function #since this particular file has never before been opened in the web browser #if it does NOT open/display in the client web browser #the fault for this can NOT be attributed to caching issues #unfortunately, when this proxy program is ran, and the computer environment told to use this proxy #this page never displays in the client web browser window (i am unsure as to why it does not display. #ive also tried various "300" codes, 301, 302,303, 307 with no change in the result.) #because 'Wireshark' cant capture traffic thats on the localhost (eg: not being sent out of the network card) #i have no way to 'view' the actual data being sent between the client program and the proxy program (on Windows) $c->send_redirect("file:///C:/http_proxy_server/FileThatsNeverBeforeBeenOpenedInTheBrowser_eg-NotCached.html", 303); } $c->close; undef($c); }