diff --git a/bin/psgi-bin/otobo.psgi b/bin/psgi-bin/otobo.psgi index a950031259..ed5051e9a3 100755 --- a/bin/psgi-bin/otobo.psgi +++ b/bin/psgi-bin/otobo.psgi @@ -433,13 +433,14 @@ my $DBViewerApp = builder { enable $AdminOnlyMiddeware; # rewrite PATH_INFO, not sure why, but at least it seems to work - enable 'Rewrite', request => sub { - $_ ||= '/dbviewer/'; - $_ = '/dbviewer/' if $_ eq '/'; - $_ = '/otobo/dbviewer' . $_; + enable 'Plack::Middleware::Rewrite', + request => sub { + $_ ||= '/dbviewer/'; + $_ = '/dbviewer/' if $_ eq '/'; + $_ = '/otobo/dbviewer' . $_; - 1; - }; + 1; + }; my $server = Mojo::Server::PSGI->new; $server->load_app("$Bin/../mojo-bin/dbviewer.pl"); @@ -454,16 +455,20 @@ my $DBViewerApp = builder { my $StaticApp = builder { # Cache css-cache for 30 days - enable_if { $_[0]->{PATH_INFO} =~ m{skins/.*/.*/css-cache/.*\.(?:css|CSS)$} } 'Header', set => [ 'Cache-Control' => 'max-age=2592000 must-revalidate' ]; + enable_if { $_[0]->{PATH_INFO} =~ m{skins/.*/.*/css-cache/.*\.(?:css|CSS)$} } 'Plack::Middleware::Header', + set => [ 'Cache-Control' => 'max-age=2592000 must-revalidate' ]; # Cache css thirdparty for 4 hours, including icon fonts - enable_if { $_[0]->{PATH_INFO} =~ m{skins/.*/.*/css/thirdparty/.*\.(?:css|CSS|woff|svn)$} } 'Header', set => [ 'Cache-Control' => 'max-age=14400 must-revalidate' ]; + enable_if { $_[0]->{PATH_INFO} =~ m{skins/.*/.*/css/thirdparty/.*\.(?:css|CSS|woff|svn)$} } 'Plack::Middleware::Header', + set => [ 'Cache-Control' => 'max-age=14400 must-revalidate' ]; # Cache js-cache for 30 days - enable_if { $_[0]->{PATH_INFO} =~ m{js/js-cache/.*\.(?:js|JS)$} } 'Header', set => [ 'Cache-Control' => 'max-age=2592000 must-revalidate' ]; + enable_if { $_[0]->{PATH_INFO} =~ m{js/js-cache/.*\.(?:js|JS)$} } 'Plack::Middleware::Header', + set => [ 'Cache-Control' => 'max-age=2592000 must-revalidate' ]; # Cache js thirdparty for 4 hours - enable_if { $_[0]->{PATH_INFO} =~ m{js/thirdparty/.*\.(?:js|JS)$} } 'Header', set => [ 'Cache-Control' => 'max-age=14400 must-revalidate' ]; + enable_if { $_[0]->{PATH_INFO} =~ m{js/thirdparty/.*\.(?:js|JS)$} } 'Plack::Middleware::Header', + set => [ 'Cache-Control' => 'max-age=14400 must-revalidate' ]; Plack::App::File->new(root => "$Bin/../../var/httpd/htdocs")->to_app; }; @@ -471,14 +476,14 @@ my $StaticApp = builder { # Port of index.pl, customer.pl, public.pl, installer.pl, migration.pl, nph-genericinterface.pl to Plack. my $App = builder { - enable "Plack::Middleware::ErrorDocument", + enable 'Plack::Middleware::ErrorDocument', 403 => '/otobo/index.pl'; # forbidden files # GATEWAY_INTERFACE is used for determining whether a command runs in a web context # Per default it would enable mysql_auto_reconnect. # But mysql_auto_reconnect is explicitly disabled in Kernel::System::DB::mysql. # OTOBO_RUNS_UNDER_PSGI indicates that PSGI is used. - enable ForceEnv => + enable 'Plack::Middleware::ForceEnv', OTOBO_RUNS_UNDER_PSGI => '1', GATEWAY_INTERFACE => 'CGI/1.1'; @@ -574,7 +579,7 @@ my $RPCApp = builder { # GATEWAY_INTERFACE is used for determining whether a command runs in a web context # OTOBO_RUNS_UNDER_PSGI is a signal that PSGI is used - enable ForceEnv => + enable 'Plack::Middleware::ForceEnv', OTOBO_RUNS_UNDER_PSGI => '1', GATEWAY_INTERFACE => 'CGI/1.1';