Bug 20582: Fix PSGI file when behind a reverse proxy
ReverseProxy middleware can modify SERVER_PORT which is used to determines which app (opac or intranet) to run, so the choice should be made before ReverseProxy middleware Signed-off-by: Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
92340d03af
commit
efc9a7d320
16
app.psgi
16
app.psgi
|
|
@ -41,12 +41,24 @@ my $port2app = {
|
|||
};
|
||||
|
||||
builder {
|
||||
# This middleware decides which app to run (opac or intranet) depending on
|
||||
# SERVER_PORT. It must be run before ReverseProxy middleware which can
|
||||
# modify SERVER_PORT
|
||||
enable sub {
|
||||
my $app = shift;
|
||||
sub {
|
||||
my $env = shift;
|
||||
$env->{'koha.app'} = $port2app->{$env->{SERVER_PORT}} || $intranet;
|
||||
return $app->($env);
|
||||
}
|
||||
};
|
||||
|
||||
enable 'ReverseProxy';
|
||||
enable '+Koha::Middleware::SetEnv';
|
||||
enable '+Koha::Middleware::RealIP';
|
||||
|
||||
sub {
|
||||
my $env = shift;
|
||||
my $app = $port2app->{$env->{SERVER_PORT}} || $intranet;
|
||||
$app->($env);
|
||||
$env->{'koha.app'}->($env);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue