Koha/debian/templates/apache-shared-intranet-plack.conf
Nick Clemens edc5caf976
Bug 37056: Mount a new intranet_svc api to avoid redirects
When an unauthorized call to svc is made, we use the ErrorDocument middleware to respond with an HTML
page. The API doens't do this, it simply returns its status. We should mount the svc as its own app to avoid
the redirect to HTML for unauthorized responses

To test:
1 - Create a report
2 - Add to IntranetUserJs:
    $(document).ready(function() {
      // Your report ID
      var reportId = '492';

      // Fetch the report
      $.get('/cgi-bin/koha/svc/report?id=' + reportId, function(data) {
        console.log('Kaboom');
      });
    });
3 - Log out
4 - Attempt to login
5 - KO
6 - Apply patch
7 - Reset all (or copy the necessary changes to your plack/apache files)
8 - Generate report and update user js again
8 - Logout, login
9 - Success!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-07-02 17:20:37 +02:00

39 lines
1.9 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Apache configuration settings that are shared for every Koha instance.
# This file contains settings for the Plack configuration of the intranet.
#
# This file should be included from an instance's
# /etc/apache2/site-available file, from within the VirtualHost section
# for the intranet.
# Plack is only available out-of-the-box for Apache 2.4.8+ setups
<IfVersion >= 2.4.8>
<IfModule mod_proxy_http.c>
# FIXME: These scripts should be fixed so they
# don't break under plack/starman
ProxyPass "/cgi-bin/koha/tools/export.pl" "!"
ProxyPass "/cgi-bin/koha/tools/upload-cover-image.pl" "!"
ProxyPass "/cgi-bin/koha/svc/cataloguing/metasearch" "!"
ProxyPreserveHost On
RequestHeader set X-FORWARDED-PROTO "https" env=HTTPS
# Point the intranet site to Plack
ProxyPass /index.html "unix:/var/run/koha/${instance}/plack.sock|http://localhost/intranet/mainpage.pl"
ProxyPassReverse /index.html "unix:/var/run/koha/${instance}/plack.sock|http://localhost/intranet/mainpage.pl"
ProxyPass /cgi-bin/koha/svc "unix:/var/run/koha/${instance}/plack.sock|http://localhost/intranet_svc"
ProxyPassReverse /cgi-bin/koha/svc "unix:/var/run/koha/${instance}/plack.sock|http://localhost/intranet_svc"
ProxyPass /cgi-bin/koha "unix:/var/run/koha/${instance}/plack.sock|http://localhost/intranet"
ProxyPassReverse /cgi-bin/koha "unix:/var/run/koha/${instance}/plack.sock|http://localhost/intranet"
# Point the /api endpoint to Plack
RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
RewriteRule ^/api/(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L,PT]
ProxyPass /api "unix:/var/run/koha/${instance}/plack.sock|http://localhost/api"
ProxyPassReverse /api "unix:/var/run/koha/${instance}/plack.sock|http://localhost/api"
</IfModule>
</IfVersion>