secret
Created

  • Download Gist
gistfile1.pl
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use Mojo::UserAgent;
use Mojo::Server::Daemon;
 
my $ua = Mojo::UserAgent->new();
my $daemon = Mojo::Server::Daemon->new(listen => ['https://*:443'])->unsubscribe('request');
$daemon->on(request => sub {
my ($daemon, $tx) =@_;
 
my $req = $tx->req->clone();
$req->url->scheme("https")->host("10.3.199.40");
 
$ua->start(Mojo::Transaction::HTTP->new(req => $req) => sub {
my ($ua, $proxy_tx) = @_;
$tx->res($proxy_tx->res)->resume();
});
});
$daemon->run;

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.