http://qs321.pair.com?node_id=11140042

scorpio17 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to create simple proxy using HTTP::Proxy as follows:
use strict; use HTTP::Proxy; my $proxy = HTTP::Proxy->new; $proxy->port( 8000 ); $proxy->init(); $proxy->agent->proxy([ [ 'http', 'https' ] => 'https://api.test.example.com/', ]); $proxy->agent->ssl_opts( verify_hostname => 0 ); $proxy->start;
If I run this on SERVER_A, I can do the following (also on SERVER_A) and it works as expected:
curl http://localhost:8000/index
But if I'm on another host (SERVER_B, for example) and I do this:
curl http://SERVER_A:8000/index
Then I get "Failed to connect : Connection refused"
I've disabled all firewalls, for testing, but that doesn't fix it.
If I use the actual IP address (instead of hostname SERVER_A) it makes no difference.
If I run the script as root (or with sudo) it makes no difference.
What am I missing here?

For what it's worth, the reason I'm trying to do this: host SERVER_B needs to access api.test.example.com, but isn't able to reach it directly. It can, however, reach SERVER_A, and SERVER_A can reach api.test.example.com, so I'd like to use SERVER_A to bridge the two.