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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.