[Koha-devel] Plack Middleware to isolate library branches via path
Thomas Klausner
domm at plix.at
Wed Apr 20 10:00:31 CEST 2022
Hi!
On Wed, Apr 20, 2022 at 10:56:36AM +1000, dcook at prosentient.com.au wrote:
> The timing of your email is interesting! I was just reflecting the other day
> about how Koha can't work off anything but the root path.
:-)
> I have a Catalyst app where I use the out of the box method $c->uri_for
> which constructs an absolute URI using the application root (e.g. /aaa/),
> but that would require rewriting Koha's templates. I use that same strategy
Most web frameworks and/or router implementations provide methods to
generate links, and those methods should honor HTTP headers like
X-Forwarded-For etc. I usually use Plack::Middleware::ReverseProxyPath
https://metacpan.org/pod/Plack::Middleware::ReverseProxyPath
which uses X-Forwarded-Script-Name and X-Traversal-Path to allow for a
very flexible setup, if the apps/routers used support those headers to
generate links (Catalyst does, AFAIK)
But I guess the reason that Koha cannot use somethink like this is that
it generates a lot of links via literal strings in the templates. And
changing this to use a method/function would be a lot of work!
Which is why I choose the rather ugly and probably not very stable
approach to fix (hopefully..) the generated URLs after rendering using a
regex...
> With your solution, how do you handle Javascript navigation that doesn't
> necessarily rely on HTML? (I can't think of any examples off the top of my
> head but I'm sure they must exist, although perhaps only on the Staff
> Interface...)
Currently we don't, but the users are as of now only starting to test
the path-based branches. We'll see what problems they'll encounter. And
we're only using this branch separation on the OPAC.
Greetings,
domm
--
#!/usr/bin/perl https://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
More information about the Koha-devel
mailing list