From 85c1434167debc22155c6633d9f2046ffbab82a6 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 15 Oct 2015 14:59:28 -0300 Subject: [PATCH] Bug 15005: Use ReverseProxyPath on plack.psgi This patch makes plack.psgi use ReverseProxyPath so %ENV{SCRIPT_NAME} is correctly set when running Koha behind a reverse proxy that changes the URI path (which is done on the Plack integration into packages). The apache includes for plack are tweaked so the needed headers are set before passing the request to the Plack backend. Edit: added missing dependency Signed-off-by: Tomas Cohen Arazi --- C4/Installer/PerlDependencies.pm | 5 +++++ debian/templates/apache-shared-intranet-plack.conf | 1 + debian/templates/apache-shared-opac-plack.conf | 1 + debian/templates/plack.psgi | 1 + 4 files changed, 8 insertions(+) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index c2bc7e6..3de50dd 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -9,6 +9,11 @@ our $PERL_DEPS = { 'required' => '1', 'min_ver' => '0.14' }, + 'Plack::Middleware::ReverseProxyPath' => { + 'usage' => 'Plack', + 'required' => '1', + 'min_ver' => '0.03' + }, 'XML::LibXSLT' => { 'usage' => 'Core', 'required' => '1', diff --git a/debian/templates/apache-shared-intranet-plack.conf b/debian/templates/apache-shared-intranet-plack.conf index 65a34a2..a5e1fb9 100644 --- a/debian/templates/apache-shared-intranet-plack.conf +++ b/debian/templates/apache-shared-intranet-plack.conf @@ -12,6 +12,7 @@ ProxyPreserveHost On # RequestHeader set X-FORWARDED-PROTO "https" + RequestHeader set "X-Forwarded-Script-Name" /cgi-bin/koha # Point the intranet site to Plack ProxyPass /cgi-bin/koha "unix:/var/run/koha/${instance}/plack.sock|http://localhost/intranet" diff --git a/debian/templates/apache-shared-opac-plack.conf b/debian/templates/apache-shared-opac-plack.conf index 95787d8..1c2633a 100644 --- a/debian/templates/apache-shared-opac-plack.conf +++ b/debian/templates/apache-shared-opac-plack.conf @@ -12,6 +12,7 @@ ProxyPreserveHost On # RequestHeader set X-FORWARDED-PROTO "https" + RequestHeader set "X-Forwarded-Script-Name" /cgi-bin/koha # Point the intranet site to Plack ProxyPass /cgi-bin/koha "unix:/var/run/koha/${instance}/plack.sock|http://localhost/opac" diff --git a/debian/templates/plack.psgi b/debian/templates/plack.psgi index 6da039f..30f4f0b 100644 --- a/debian/templates/plack.psgi +++ b/debian/templates/plack.psgi @@ -65,6 +65,7 @@ my $opac = Plack::App::CGIBin->new( builder { enable "ReverseProxy"; + enable "ReverseProxyPath"; enable "Plack::Middleware::Static"; mount '/opac' => $opac; -- 2.6.1