[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
Mon Jul 16 02:22:28 CEST 2018


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

--- Comment #9 from David Cook <dcook at prosentient.com.au> ---
(In reply to Marcel de Rooy from comment #8)
> From the plack counterpart:
>         RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
>         RewriteRule ^/api/(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L,PT]
> 
> From your patch:
>     RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
>     RewriteRule ^(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L]
> 
> Not the same. You start with v[0-9] which seems to be wrong ;)
> How did you test?
> 

It might seem wrong but it's not wrong ;). 

The reason is that these directives are happening in a Directory block with a
RewriteBase of /api/ (note that in Apache 2.4 without an explicit RewriteBase
an implicit one will be created anyway), so Apache strips off the "/api/" part
after it matches the RewriteCond. You can check this using a logging directive
like "LogLevel alert rewrite:trace3".

I tested by putting in the Apache config with the directives I've included in
these patches along with the logging I mention above and I observed that my
test plan worked. 

> Note btw that v[0-9]+ may not be what we want. It covers v987654321 for
> instance. We do not have v0, but only v1. Hoping for v2 :)

That may be true but I don't think that's within the scope of this bug report.
This patch is just trying to bring the CGI config in line with the Plack
config. 

I'd like to reset this status back to Signed Off. I can provide some logging
output if that would be helpful in regards to the RewriteRule?

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


More information about the Koha-bugs mailing list