From 67db0abd50ece42faa970c20beaeb60d8d3fe03f Mon Sep 17 00:00:00 2001 From: Liz Rea Date: Thu, 4 Nov 2021 18:56:17 -0500 Subject: [PATCH] Bug 29420 - 401 Unauthorized pages come back is 200 OK under plack To test: - create an alias in your /etc/koha/sites/.conf file for something like files Alias /files "/var/lib/koha/kohadev/public_html/" Options +Indexes AuthUserFile /var/lib/koha/kohadev/.htpasswd AuthName ByPassword AuthType Basic require valid-user - make a .htpasswd file: https://hostingcanada.org/htpasswd-generator/ and put it in /var/lib/koha/kohadev - restart apache - navigate to http:///files, note that the response header in the browser inspector says "200 OK" and the basic auth user/pass is not shown - Apply this patch, restart the things - navigate to http:///files, note that the response header in the browser inspector says "401 Unauthorized" and the basic auth user/pass is now shown Signed-off-by: Nick Clemens --- errors/401.pl | 2 +- opac/errors/401.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/errors/401.pl b/errors/401.pl index 5cc3ac432d..2531262f40 100755 --- a/errors/401.pl +++ b/errors/401.pl @@ -38,6 +38,6 @@ $template->param ( ); my $status = '401 Unauthorized'; if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) { - $status = '200 OK'; + $status = '401 Unauthorized'; } output_with_http_headers $query, $cookie, $template->output, 'html', $status; diff --git a/opac/errors/401.pl b/opac/errors/401.pl index 91fbc2dccc..f9852b7f11 100755 --- a/opac/errors/401.pl +++ b/opac/errors/401.pl @@ -39,6 +39,6 @@ $template->param ( ); my $status = '401 Unauthorized'; if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) { - $status = '200 OK'; + $status = '401 Unauthorized'; } output_with_http_headers $query, $cookie, $template->output, 'html', $status; -- 2.20.1