[Bug 15005] New: (Plack) Use of SCRIPT_NAME makes Koha generate wrong URIs
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Bug ID: 15005 Summary: (Plack) Use of SCRIPT_NAME makes Koha generate wrong URIs Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: gmcharlt@gmail.com Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org The current plack-on-packages schema points the apache vhost (for example for the intranet) like this: /cgi-bin/koha/ => /intranet/ So the code that uses ENV{SCRIPT_NAME} "sees" it is being called for example like /intranet/mainpage.pl. This gets problematic in some scenarios, because it is used to then redirect the browser, or to create links to things. Steps to reproduce: - Check out an old DBRev in the koha repo (1 step older is ok) - Pick the ansible branch from the kohadevbox [1] - Launch it, on jessie: $ vagrant up jessie - Log into it $ vagrant ssh jessie - Enable Plack for the automatically created instance $ sudo koha-plack --enable kohadev $ sudo koha-plack --start kohadev $ sudo service apache2 restart - Get the DB password to be able to login $ koha-pass - Point your browser to the staff interface: http://localhost:8081 - Login with koha_kohadev and the retrieved password => FAIL: You cannot login - Disable Plack for the instance $ sudo koha-plack --disable kohadev $ sudo koha-plack --stop kohadev $ sudo service apache2 restart - Point your browser to the staff interface: http://localhost:8081 - Login with koha_kohadev and the retrieved password => SUCCESS: You can login - Proceed to install with the default data (you can try enabling plack and you will notice it works) - Once you are in, enable plack $ sudo koha-plack --enable kohadev $ sudo koha-plack --start kohadev $ sudo service apache2 restart - Checkout the latest master (so it triggers an update) - Go somewhere inside (about?) - You are required to login (which is expected) => FAIL: the links back are pointing to /intranet/ so they are shortcircuited to the installer cyclically (see screenshot) [1] https://github.com/digibib/kohadevbox/tree/ansible -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 43383 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43383&action=edit Wrong links generated -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|gmcharlt@gmail.com |jonathan.druart@bugs.koha-c | |ommunity.org -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 43387 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43387&action=edit Bug 15005: Replace CGI->url with the corresponding url CGI->url does not return the correct url on install using packages. Test plan: 1/ Try to reproduce the bug from the description of bug 15005. You should be able to login to the intranet and the OPAC 2/ Send a basket and a list from the intranet and the OPAC. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 43388 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43388&action=edit Bug 15005: Remove CGI->url calls from pl scripts Same as previous patch for calls in pl scripts. Test plan: - delete an entry of your search history from intranet and opac - with IndependentBranches=OFF, go on the waiting holds and confirm that the link next to 'Holds awaiting pickup for your library on' is correct. - search for items, the pagination should work correctly -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 43389 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43389&action=edit Bug 15005: Fix pagination_bar calls Test plan: Create an order for an existing biblio, confirm that the pagination links work correctly. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Breaking news: Add this line to /etc/koha/sites/kohadev/plack.psgi enable "ReverseProxyPath"; And this one to /etc/koha/apache-shared-intranet-plack.conf RequestHeader set "X-Forwarded-Script-Name" /cgi-bin/koha fix the $ENV{SCRIPT_NAME}! ($cgi->url still does not work) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Heather Braum <hbraum@nekls.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hbraum@nekls.org -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=15015 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 43443 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43443&action=edit Bug 15005: Use ReverseProxyPath on plack.psgi This patch makes plack.psgi use ReverseProxyPath so %ENV{SCRIPT_NAME} is correctly set when running Koha behind a reverse proxy that changes the URI path (which is done on the Plack integration into packages). The apache includes for plack are tweaked so the needed headers are set before passing the request to the Plack backend. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #43443|0 |1 is obsolete| | --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 43444 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43444&action=edit Bug 15005: Use ReverseProxyPath on plack.psgi This patch makes plack.psgi use ReverseProxyPath so %ENV{SCRIPT_NAME} is correctly set when running Koha behind a reverse proxy that changes the URI path (which is done on the Plack integration into packages). The apache includes for plack are tweaked so the needed headers are set before passing the request to the Plack backend. Edit: added missing dependency Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #43387|0 |1 is obsolete| | --- Comment #8 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 43447 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43447&action=edit Bug 15005: Replace CGI->url with the corresponding url CGI->url does not return the correct url on install using packages. Test plan: 1/ Try to reproduce the bug from the description of bug 15005. You should be able to login to the intranet and the OPAC 2/ Send a basket and a list from the intranet and the OPAC. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #43388|0 |1 is obsolete| | --- Comment #9 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 43448 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43448&action=edit Bug 15005: Remove CGI->url calls from pl scripts Same as previous patch for calls in pl scripts. Test plan: - delete an entry of your search history from intranet and opac - with IndependentBranches=OFF, go on the waiting holds and confirm that the link next to 'Holds awaiting pickup for your library on' is correct. - search for items, the pagination should work correctly Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #43389|0 |1 is obsolete| | --- Comment #10 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 43449 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43449&action=edit Bug 15005: Fix pagination_bar calls Test plan: Create an order for an existing biblio, confirm that the pagination links work correctly. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |josef.moravec@gmail.com --- Comment #11 from Josef Moravec <josef.moravec@gmail.com> --- The patches works as expected. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #43444|0 |1 is obsolete| | --- Comment #12 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 43451 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43451&action=edit Bug 15005: Replace $ENV{SCRIPT_NAME} with the hardcoded script paths Since I don't manage to make SCRIPT_NAME works directly with RequestHeader and/or ReverseProxyPath, the easier way it to fix all the different occurrences. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #13 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Tomás Cohen Arazi from comment #7)
Created attachment 43444 [details] [review] Bug 15005: Use ReverseProxyPath on plack.psgi
This patch makes plack.psgi use ReverseProxyPath so %ENV{SCRIPT_NAME} is correctly set when running Koha behind a reverse proxy that changes the URI path (which is done on the Plack integration into packages).
The apache includes for plack are tweaked so the needed headers are set before passing the request to the Plack backend.
Edit: added missing dependency
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Tomas, Unfortunately, this does not work, the path generated is now /cgi-bin/koha/intranet/modules/script.pl (note the '/intranet'). The last patch I have proposed should fix the issue on a silly way (but working...). -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #43447|0 |1 is obsolete| | Attachment #43448|0 |1 is obsolete| | Attachment #43449|0 |1 is obsolete| | Attachment #43451|0 |1 is obsolete| | --- Comment #14 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 43452 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43452&action=edit Bug 15005: Replace CGI->url with the corresponding url CGI->url does not return the correct url on install using packages. Test plan: 1/ Try to reproduce the bug from the description of bug 15005. You should be able to login to the intranet and the OPAC 2/ Send a basket and a list from the intranet and the OPAC. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #15 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 43453 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43453&action=edit Bug 15005: Remove CGI->url calls from pl scripts Same as previous patch for calls in pl scripts. Test plan: - delete an entry of your search history from intranet and opac - with IndependentBranches=OFF, go on the waiting holds and confirm that the link next to 'Holds awaiting pickup for your library on' is correct. - search for items, the pagination should work correctly Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #16 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 43454 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43454&action=edit Bug 15005: Fix pagination_bar calls Test plan: Create an order for an existing biblio, confirm that the pagination links work correctly. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #17 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 43455 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43455&action=edit Bug 15005: Replace $ENV{SCRIPT_NAME} with the hardcoded script paths Since I don't manage to make SCRIPT_NAME works directly with RequestHeader and/or ReverseProxyPath, the easier way it to fix all the different occurrences. Test plan: On the import patrons page, confirm that the "Import" button does not redirect to a 'Not found' page. You should stay on the import patrons page. Note that if this change works, all others should work too. Have a look at the diff of this patch and confirm there is no typo. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |15019 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15019 [Bug 15019] Plack testing - Umbrella -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #18 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- *** Bug 15014 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #19 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- *** Bug 15015 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #20 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- *** Bug 15016 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #43455|0 |1 is obsolete| | --- Comment #21 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 43484 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43484&action=edit Bug 15005: Replace $ENV{SCRIPT_NAME} with the hardcoded script paths Since I don't manage to make SCRIPT_NAME works directly with RequestHeader and/or ReverseProxyPath, the easier way it to fix all the different occurrences. Test plan: On the import patrons page, confirm that the "Import" button does not redirect to a 'Not found' page. You should stay on the import patrons page. Note that if this change works, all others should work too. Have a look at the diff of this patch and confirm there is no typo. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Tested in patron import and item batch modification -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #43452|0 |1 is obsolete| | Attachment #43453|0 |1 is obsolete| | Attachment #43454|0 |1 is obsolete| | Attachment #43484|0 |1 is obsolete| | --- Comment #22 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 43534 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43534&action=edit [PASSED QA] Bug 15005: Replace CGI->url with the corresponding url CGI->url does not return the correct url on install using packages. Test plan: 1/ Try to reproduce the bug from the description of bug 15005. You should be able to login to the intranet and the OPAC 2/ Send a basket and a list from the intranet and the OPAC. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #23 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 43535 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43535&action=edit [PASSED QA] Bug 15005: Remove CGI->url calls from pl scripts Same as previous patch for calls in pl scripts. Test plan: - delete an entry of your search history from intranet and opac - with IndependentBranches=OFF, go on the waiting holds and confirm that the link next to 'Holds awaiting pickup for your library on' is correct. - search for items, the pagination should work correctly Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #24 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 43536 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43536&action=edit [PASSED QA] Bug 15005: Fix pagination_bar calls Test plan: Create an order for an existing biblio, confirm that the pagination links work correctly. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 --- Comment #25 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 43537 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43537&action=edit [PASSED QA] Bug 15005: Replace $ENV{SCRIPT_NAME} with the hardcoded script paths Since I don't manage to make SCRIPT_NAME works directly with RequestHeader and/or ReverseProxyPath, the easier way it to fix all the different occurrences. Test plan: On the import patrons page, confirm that the "Import" button does not redirect to a 'Not found' page. You should stay on the import patrons page. Note that if this change works, all others should work too. Have a look at the diff of this patch and confirm there is no typo. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Tested in patron import and item batch modification Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Kyle M Hall <kyle.m.hall@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle.m.hall@gmail.com --- Comment #26 from Kyle M Hall <kyle.m.hall@gmail.com> --- Note: SCRIPT_NAME is referenced in a number of templates and a few perl scripts. In some cases it is passed to the template as a parameter. In others it is not, which makes the form action submit to the current url. As far as I'm aware this works fine and is non-detrimental, but I did want to make a note of it. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Status|Passed QA |Pushed to Master --- Comment #27 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Patches pushed to master. Thanks Jonathan! We need to fill an enhancement bug for letting Koha stand in whatever endpoint we want instead of the legacy URI path. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15005 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=15045 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org