Skip to content

Instantly share code, notes, and snippets.

@leedo
Created September 13, 2011 19:47
Show Gist options
  • Select an option

  • Save leedo/1214888 to your computer and use it in GitHub Desktop.

Select an option

Save leedo/1214888 to your computer and use it in GitHub Desktop.
use Plack::Builder;
use Plack::App::Proxy;
my $proxy = Plack::App::Proxy->new(
remote => "http://dev.office.xerox.com",
preserve_host_header => 1,
);
builder {
mount "/" => sub {
my $env = shift;
$env->{HTTP_HOST} =~ s/:\d+$//;
$proxy->($env);
};
mount "/foo" => sub {
[200, ['Content-type', 'text/plain'], ['This page served via plack']];
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment