From c7f66d7d14cea365e73ac5fcb2cf80e3b9f823fc Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 20 May 2020 15:08:05 +1000 Subject: [PATCH] Bug 25548: Remove Apache rewrite directives that trigger redirects Historically, we have used Apache rewrite directives to strip query parameters with no arguments from the query string (e.g. PARAM=&), and then redirect to the new URL. However, this slows down user activity, and depending on your HTTPS and proxy setup can cause suboptimal HTTP downgrades and upgrades. Test Plan: 0) Apply patch 1) Build Debian package 2) Install Debian package and reload Apache 3) Open developer tools on your favourite browser 4) Go to Network tab in developer tools 5) Go to /cgi-bin/koha/opac-main.pl 6) Search for "test" 7) Note a 200 status for "opac-search.pl?idx=&q=test" If you got a 302 status for "opac-search.pl?idx=&q=test" followed by a 200 status for "opac-search.pl?q=test", you will know that your Apache configuration wasn't updated. Signed-off-by: Fridolin Somers Signed-off-by: Julian Maurice Signed-off-by: Jonathan Druart (cherry picked from commit 181125242c33d439fb6bdbddccb6a86a03fa8c15) Signed-off-by: Andrew Fuerste-Henry --- debian/templates/apache-shared-intranet.conf | 2 -- debian/templates/apache-shared-opac.conf | 2 -- 2 files changed, 4 deletions(-) diff --git a/debian/templates/apache-shared-intranet.conf b/debian/templates/apache-shared-intranet.conf index 001342f515..7e58a48158 100644 --- a/debian/templates/apache-shared-intranet.conf +++ b/debian/templates/apache-shared-intranet.conf @@ -15,8 +15,6 @@ ScriptAlias /search "/usr/share/koha/intranet/cgi-bin/catalogue/search.pl" RewriteEngine on RewriteRule ^/cgi-bin/koha/(C4|debian|etc|installer/data|install_misc|Koha|misc|selenium|t|test|tmp|xt)/|\.PL$ /notfound [PT] -RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*) -RewriteRule (.+) $1?%1%2 [N,R,NE] RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/catalogue/detail.pl?biblionumber=$1 [PT] RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT] RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT] diff --git a/debian/templates/apache-shared-opac.conf b/debian/templates/apache-shared-opac.conf index 2a7e9ace16..2568e0c966 100644 --- a/debian/templates/apache-shared-opac.conf +++ b/debian/templates/apache-shared-opac.conf @@ -12,8 +12,6 @@ ScriptAlias /index.html "/usr/share/koha/opac/cgi-bin/opac/opac-main.pl" ScriptAlias /search "/usr/share/koha/opac/cgi-bin/opac/opac-search.pl" ScriptAlias /opac-search.pl "/usr/share/koha/opac/cgi-bin/opac/opac-search.pl" -RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*) -RewriteRule (.+) $1?%1%2 [N,R,NE] RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT] RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT] RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT] -- 2.39.5