[Koha-bugs] [Bug 21031] Apache Rewrite rules don't work for API when using anything but Debian package Plack configuration

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jul 20 05:53:06 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21031

--- Comment #13 from David Cook <dcook at prosentient.com.au> ---
Created attachment 77148
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=77148&action=edit
Apache_rewrite_log.txt

Apologies for the delay on getting this out. 

As you can see, because we're in a directory ending in "api", the "api" gets
stripped out of the uri:

[Fri Jul 20 13:43:01.358964 2018] [rewrite:trace1] [pid 11341]
mod_rewrite.c(477): [client 192.168.1.100:15501] 192.168.1.100 - -
[192.168.1.200/sid#7f1ca31258b0][rid#7f1c9d3a50a0/initial] pass through
/api/v1/cities
[Fri Jul 20 13:43:01.359158 2018] [rewrite:trace3] [pid 11341]
mod_rewrite.c(477): [client 192.168.1.100:15501] 192.168.1.100 - -
[192.168.1.200/sid#7f1ca31258b0][rid#7f1c9d3a50a0/initial] [perdir
/home/dcook/koha/api/] strip per-dir prefix: /home/dcook/koha/api/v1/cities ->
v1/cities
[Fri Jul 20 13:43:01.359189 2018] [rewrite:trace3] [pid 11341]
mod_rewrite.c(477): [client 192.168.1.100:15501] 192.168.1.100 - -
[192.168.1.200/sid#7f1ca31258b0][rid#7f1c9d3a50a0/initial] [perdir
/home/dcook/koha/api/] applying pattern '^(v[0-9]+)/(.*)$' to uri 'v1/cities'
[Fri Jul 20 13:43:01.359271 2018] [rewrite:trace2] [pid 11341]
mod_rewrite.c(477): [client 192.168.1.100:15501] 192.168.1.100 - -
[192.168.1.200/sid#7f1ca31258b0][rid#7f1c9d3a50a0/initial] [perdir
/home/dcook/koha/api/] rewrite 'v1/cities' -> '/api/v1/app.pl/api/v1/cities'
[Fri Jul 20 13:43:01.359302 2018] [rewrite:trace2] [pid 11341]
mod_rewrite.c(477): [client 192.168.1.100:15501] 192.168.1.100 - -
[192.168.1.200/sid#7f1ca31258b0][rid#7f1c9d3a50a0/initial] [perdir
/home/dcook/koha/api/] trying to replace prefix /home/dcook/koha/api/ with
/api/
[Fri Jul 20 13:43:01.359334 2018] [rewrite:trace2] [pid 11341]
mod_rewrite.c(477): [client 192.168.1.100:15501] 192.168.1.100 - -
[192.168.1.200/sid#7f1ca31258b0][rid#7f1c9d3a50a0/initial] [perdir
/home/dcook/koha/api/] trying to replace context docroot /home/dcook/koha/api
with context prefix /api
[Fri Jul 20 13:43:01.359353 2018] [rewrite:trace1] [pid 11341]
mod_rewrite.c(477): [client 192.168.1.100:15501] 192.168.1.100 - -
[192.168.1.200/sid#7f1ca31258b0][rid#7f1c9d3a50a0/initial] [perdir
/home/dcook/koha/api/] internal redirect with /api/v1/app.pl/api/v1/cities
[INTERNAL REDIRECT]

I admit that I don't 100% understand some of the later lines. I get the "strip
per-dir prefix", "applying pattern", "rewrite" and "internal redirect", but I
don't understand why "trying to replace prefix" and "trying to replace context
docroot" happen. Maybe I need to increase the trace level to 5 from 3 - I don't
know.

But yeah the important thing is that the RewriteRule for non-Plack Apache
configuration shouldn't include the "api" path since the directory-level
configuration means "api" gets stripped out of the incoming uri.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list