[Bug 43805] New: Logging back in after a session timeout 404s on Vue pages served through a RewriteRule (record_sources, circulation_triggers)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Bug ID: 43805 Summary: Logging back in after a session timeout 404s on Vue pages served through a RewriteRule (record_sources, circulation_triggers) Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Target Milestone: --- Staff interface pages that are served through a RewriteRule of the form RewriteRule ^/cgi-bin/koha/admin/record_sources(.*)?$ /cgi-bin/koha/admin/record_sources.pl$1 [PT] (etc/koha-httpd.conf and debian/templates/apache-shared-intranet.conf; the same shape is used for admin/circulation_triggers) cannot be logged back in to after the session times out. The pattern also matches the script's own name, so a request for record_sources.pl is rewritten to record_sources.pl.pl and returns 404. When the login form is shown on such a page, its action is the script name (/cgi-bin/koha/admin/record_sources.pl). Submitting it therefore 404s, no session is created, and the user is stuck on an error page until they log in through another page (for example mainpage.pl) and navigate back. To reproduce (main, 26.06.00.035, in KTD): 1. Log out (or let the session expire). 2. Open /cgi-bin/koha/admin/record_sources. The login page is shown; its form action is /cgi-bin/koha/admin/record_sources.pl. 3. Enter valid credentials and submit. Expected: you are logged in and see the record sources page. Actual: "Error 404 > Koha". No session is created. Evidence with curl (cookie jar, valid csrf_token taken from the login page): - POST to the form action /cgi-bin/koha/admin/record_sources.pl -> 404 - POST of the same fields to /cgi-bin/koha/admin/record_sources -> 200 GET /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/circulation_triggers.pl also return 404. Not affected: acquisition/vendors, whose rule maps acquisition/vendors to acqui/vendors.pl, so acqui/vendors.pl is reachable (200). Found while building a new Vue page under Cataloguing (bug 30800), which copies the same rule and so has the same problem. Possible directions (not verified): - Guard the rules so the script's own name is not rewritten, as is already done for preservation in the same file: RewriteCond %{REQUEST_URI} !^/cgi-bin/koha/preservation/.*.pl$ A similar RewriteCond for each of these pages would let the .pl URL reach the script. The Vue router base paths are the extensionless URLs, so it needs checking what the app does when it is loaded on the .pl URL after login. - Or have the login form post back to the URL the user actually requested instead of the script name when the request was rewritten. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 207975 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207975&action=edit Bug 43805: Don't rewrite requests for the .pl script of Vue pages The rewrite rules for admin/record_sources and admin/circulation_triggers match any URL starting with the page name, so they also match the real script, /cgi-bin/koha/admin/record_sources.pl, and turn it into record_sources.pl.pl, which does not exist. This is normally invisible because the Vue pages are reached without the extension. It breaks when a session times out: the login form posts back to the .pl URL, and the user gets a 404 instead of landing on the page they were on. Skip the rewrite when the request is already for the .pl script, as is already done for the preservation and ill rules. Test plan: 1. Without the patch, as a logged in staff user, visit /cgi-bin/koha/admin/record_sources.pl and /cgi-bin/koha/admin/circulation_triggers.pl => 404 for both. 2. Apply the patch and restart Apache (restart_all in KTD, or reload the apache config after regenerating it on a package install). 3. Visit the same two URLs again => The pages load. 4. Visit /cgi-bin/koha/admin/record_sources, /cgi-bin/koha/admin/record_sources/add and /cgi-bin/koha/admin/circulation_triggers => They still load, and the Vue router still works within them. 5. Open /cgi-bin/koha/admin/record_sources, then in another tab log out. Back in the first tab, reload the page, log in again => You land on the record sources page, not a 404. 6. Repeat step 5 for /cgi-bin/koha/admin/circulation_triggers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matt.blenkinsop@openfifth.c | |o.uk, tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43805 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #2 from David Nind <david@davidnind.com> --- Is anything else required after applying the patch for the redirects to work correctly? While I no longer get 404s, I get: 1. /cgi-bin/koha/admin/record_sources.pl - page with the standard staff interface header and sidebar (no breadcrumb or body content) 2. /cgi-bin/koha/admin/circulation_triggers.pl - page with the standard staff interface header (no sidebar, breadcrumb, or body content) I also tried: 1. A yarn build and a restart_all 2. A reset_all 3. Shutting down KTD and then restarting with the patch applied 4. Same as 3, then a yarn build and restart_all 5. In call cases browser cache cleared after patch applied. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org