Bug 18669 - RewriteCond affecting wrong rule in koha-httpd.conf
Summary: RewriteCond affecting wrong rule in koha-httpd.conf
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: David Cook
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks: 25548
  Show dependency treegraph
 
Reported: 2017-05-25 04:29 UTC by David Cook
Modified: 2020-10-08 09:21 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 18669 - RewriteCond affecting wrong rule in koha-httpd.conf (2.24 KB, patch)
2017-05-25 04:44 UTC, David Cook
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 18669 - RewriteCond affecting wrong rule in koha-httpd.conf (2.30 KB, patch)
2017-05-25 05:48 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 18669 - RewriteCond affecting wrong rule in koha-httpd.conf (2.39 KB, patch)
2017-05-26 10:05 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2017-05-25 04:29:19 UTC
With Bug 9683, we removed an unnecessary RewriteRule from the Apache configuration. However, by removing that RewriteRule directive, we accidentally made the preceding RewriteCond affect the following rule instead:

RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]

So I'm just going to remove the RewriteCond from etc/koha-httpd.conf as it's causing problems with a rewrite rule which works with Debian packages and properly configured source installs.
Comment 1 David Cook 2017-05-25 04:44:09 UTC
Created attachment 63709 [details] [review]
Bug 18669 - RewriteCond affecting wrong rule in koha-httpd.conf

One of the RewriteCond directives in koha-httpd.conf was affecting
the wrong RewriteRule after its original RewriteRule was commented out
years ago.

_TEST PLAN_
0) Before applying patch, build Koha from source
    *) make
    *) make install (or make upgrade)
    *) Copy or symlink etc/koha-httpd.conf to your Apache vhost directory
        (and enable if you're on a Debian based system)
    *) Restart Apache
1) Make sure that you have at least 1 bibliographic record in Koha
(URL like this http://server:port/cgi-bin/koha/opac-detail.pl?biblionumber=1)
2) Go to http://server:port/bib/1
3) Note that you get a 404 error
4) Apply the patch
5) Rebuild Koha from source as per step 0
6) Go to http://server:port/bib/1
7) Note that you now see the same page as you would if you went to
http://server:port/cgi-bin/koha/opac-detail.pl?biblionumber=1
Comment 2 Josef Moravec 2017-05-25 05:48:36 UTC
Created attachment 63711 [details] [review]
[SIGNED-OFF] Bug 18669 - RewriteCond affecting wrong rule in koha-httpd.conf

One of the RewriteCond directives in koha-httpd.conf was affecting
the wrong RewriteRule after its original RewriteRule was commented out
years ago.

_TEST PLAN_
0) Before applying patch, build Koha from source
    *) make
    *) make install (or make upgrade)
    *) Copy or symlink etc/koha-httpd.conf to your Apache vhost directory
        (and enable if you're on a Debian based system)
    *) Restart Apache
1) Make sure that you have at least 1 bibliographic record in Koha
(URL like this http://server:port/cgi-bin/koha/opac-detail.pl?biblionumber=1)
2) Go to http://server:port/bib/1
3) Note that you get a 404 error
4) Apply the patch
5) Rebuild Koha from source as per step 0
6) Go to http://server:port/bib/1
7) Note that you now see the same page as you would if you went to
http://server:port/cgi-bin/koha/opac-detail.pl?biblionumber=1

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 3 Josef Moravec 2017-05-25 05:50:19 UTC
I just signed off, because it does work as described, but I am just curious if we should make the changes from bug 9683 and this bug to debian apache templates too...
Comment 4 David Cook 2017-05-26 03:52:01 UTC
(In reply to Josef Moravec from comment #3)
> I just signed off, because it does work as described, but I am just curious
> if we should make the changes from bug 9683 and this bug to debian apache
> templates too...

Thanks, Josef. 

I figure it's probably a good idea to update the Debian templates as well, but I imagine that should be a separate bug. 

Soon, I'm going to set up a Debian virtual machine to test Debian-specific patches so maybe at that point I'll post some patches (or be able to test someone else's).
Comment 5 Marcel de Rooy 2017-05-26 10:05:14 UTC
Created attachment 63740 [details] [review]
Bug 18669 - RewriteCond affecting wrong rule in koha-httpd.conf

One of the RewriteCond directives in koha-httpd.conf was affecting
the wrong RewriteRule after its original RewriteRule was commented out
years ago.

_TEST PLAN_
0) Before applying patch, build Koha from source
    *) make
    *) make install (or make upgrade)
    *) Copy or symlink etc/koha-httpd.conf to your Apache vhost directory
        (and enable if you're on a Debian based system)
    *) Restart Apache
1) Make sure that you have at least 1 bibliographic record in Koha
(URL like this http://server:port/cgi-bin/koha/opac-detail.pl?biblionumber=1)
2) Go to http://server:port/bib/1
3) Note that you get a 404 error
4) Apply the patch
5) Rebuild Koha from source as per step 0
6) Go to http://server:port/bib/1
7) Note that you now see the same page as you would if you went to
http://server:port/cgi-bin/koha/opac-detail.pl?biblionumber=1

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Kyle M Hall 2017-05-29 02:30:34 UTC
Pushed to master for 17.05, thanks David!
Comment 7 Katrin Fischer 2017-06-05 12:54:51 UTC
This patch has been pushed to 16.11.x and will be in 16.11.09.
Comment 8 Mason James 2017-07-31 11:05:45 UTC
Pushed to 16.05.x, for 16.05.15 release