Koha/debian/templates/apache-shared-intranet.conf
David Cook 181125242c 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 <fridolin.somers@biblibre.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-11-20 14:23:52 +01:00

33 lines
1.2 KiB
Text

# Apache configuration settings that are shared for every Koha instance.
# This file contains settings for the intranet site.
#
# This file should be included from an instance's
# /etc/apache2/site-available file, from within the VirtualHost section
# for the intranet.
DocumentRoot /usr/share/koha/intranet/htdocs
ScriptAlias /cgi-bin/koha/ "/usr/share/koha/intranet/cgi-bin/"
ScriptAlias /index.html "/usr/share/koha/intranet/cgi-bin/mainpage.pl"
ScriptAlias /search "/usr/share/koha/intranet/cgi-bin/catalogue/search.pl"
# Protect dev package install
RewriteEngine on
RewriteRule ^/cgi-bin/koha/(C4|debian|etc|installer/data|install_misc|Koha|misc|selenium|t|test|tmp|xt)/|\.PL$ /notfound [PT]
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]
RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
Alias "/api" "/usr/share/koha/api"
<Directory "/usr/share/koha/api">
Options +ExecCGI +FollowSymlinks
AddHandler cgi-script .pl
SetEnv MOJO_MODE "production"
RewriteBase /api/
RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
RewriteRule ^(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L]
</Directory>