更新:我想您只需要添加以下内容
enable "ReverseProxy"; ## Plack::Middleware::ReverseProxy
enable "ReverseProxyPath"; ## Plack::Middleware::ReverseProxyPath
更新:您可能还需要编辑您的 apache httpd conf 以将 nocanon 添加到 proxypass ...
以下*为*原创**回复
它不是硬编码的,自己看(我必须)
https://github.com/plack/Plack/wiki/How-to-detect-reverse-proxy-and-SSL-frontend
http://p3rl.org/Plack::Middleware::ReverseProxy
http://advent。 plackperl.org/2009/12/day-12-maps-multiple-apps-with-mount-and-urlmap.html
#!/usr/bin/perl --
#~ plack-debug-mounted.pl
#~ 2013-10-17-02:59:26
#~
## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*"
#!/usr/bin/perl --
use CGI();
use Data::Dump qw/ dd pp /;
use Path::Tiny qw/ path /;
use Plack::Builder;
use Plack::Runner;
my $selfsourceapp = sub {
return [
'200',
[ 'Content-Type' => 'text/plain', ],
[ path( __FILE__ )->slurp_raw ],
];
};
my $dumperapp = sub {
my $q = CGI->new( $_[0] );
return [
'200', [
'Content-Type' => 'text/html',
'Content-Length' => '2',
], [
$q->start_html( -title => 'dumpenv.psgi' ),
$q->h1( $_[0]->{SCRIPT_NAME} ),
$q->Dump, $q->end_html,
],
];
};
my $indexapp = sub {
return [
'200',
[ 'Content-Type' => 'text/html', ],
[
q{<doctype html>
<html lang="en-US" charset="UTF-8">
<title> Plack perlology </title>
<body>
<p> A Plack::Middleware::Debug free zone
<br> <a href="/"> this </a>
<br> <a href="/dumpenv"> dupenv </a>
<br> <a href="/selfsrc"> selfsrc </a>
<p> Get <c>Plack::Middleware::Debug</c> <b> ed </b>
<br> <a href="/debugged/"> /debugged/ this </a>
<br> <a href="/debugged/dumpenv"> /debugged/dupenv </a>
<br> <a href="/debugged/selfsrc"> /debugged/selfsrc </a>
<p> Come get some
<br> <a href="/debugged/debug_toolbar/toolbar.min.css">
/debugged/debug_toolbar/toolbar.min.css
</a>
<br> <a href="/debugged/debug_toolbar/toolbar.min.js">
/debugged/debug_toolbar/toolbar.min.js
</a>
<p> Cant get this
<br> <a href="/debug_toolbar/toolbar.min.css">
/debug_toolbar/toolbar.min.css
</a>
<br> <a href="/toolbar.min.css">
/toolbar.min.css
</a>
</body><!-- before this Plack::Middleware::Debug inserts, viewsource!! -->
}
],
];
};
my $finalapp = builder {
mount '/debugged' => builder {
enable 'Debug', panels => [
qw/
Timer
Response
Environment
Session
Parameters
/
];
mount "/dumpenv" => $dumperapp;
mount "/selfsrc" => $selfsourceapp;
mount "/" => $indexapp;
};
mount "/dumpenv" => $dumperapp;
mount "/selfsrc" => $selfsourceapp;
mount "/" => $indexapp;
};
my $runner = Plack::Runner->new;
$runner->parse_options( qw' --host 127.0.0.1 --port 80 ' );
$runner->run( $finalapp );