How to make self-referential URLs in Koha
Hi all, With some recent code, I've been using creating self-referential URL in Koha using CGI->url(), and passing it as a value. With CGI, the URL is correct (ie starting with /cgi-bin/koha). With Plack, it's not, because the OPAC is mounted as "/opac". I worked around this by rewriting the self-referential URL in my code, but I was wondering if anyone else had any thoughts on this. I've noticed there are a few places in Koha where we use CGI->url() and I'm guessing we may have unexpected bugs in Plack-enabled Koha as a result. Of course, one workaround would be to have /opac and /intranet aliases or URL rewriting in Apache, so that the self-referential URLs created by Plack still end up resolving. I wonder if that's the easiest path forward. In the past, I have wondered if we could get rid of "/cgi-bin/koha" as a path prefix all together (especially as cgi-bin scares security tools), but it's so deeply embedded in Koha at this point that it seems a huge task to replace it. Anyway, just throwing that out there. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595
In the past, I have wondered if we could get rid of “/cgi-bin/koha” as a path prefix all together
No idea what that would involve (other than search-and-replace in the templates), but from the user's point of view I think it would be a nice improvement. -- Owen -- Web Developer Athens County Public Libraries (740) 737-6006 https://www.myacpl.org
I think that would also me a great cosmetic enhancement. At the risk of scope creep, we could go a step further by mapping the perl scripts to paths as well, so /cgi-bin/koha/circ/circulation-home.pl could become /circulation/home ( or even just /circulation ) for example. Kyle --- http://www.kylehall.info ByWater Solutions ( http://bywatersolutions.com ) Meadville Public Library ( http://www.meadvillelibrary.org ) Crawford County Federated Library System ( http://www.ccfls.org ) On Tue, May 19, 2020 at 9:08 AM Owen Leonard <oleonard@myacpl.org> wrote:
In the past, I have wondered if we could get rid of “/cgi-bin/koha” as a path prefix all together
No idea what that would involve (other than search-and-replace in the templates), but from the user's point of view I think it would be a nice improvement.
-- Owen
-- Web Developer Athens County Public Libraries (740) 737-6006 https://www.myacpl.org _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
So happy to see responses to this ^_^ Owen: It looks like we’d need to do a search and replace in the templates and the code. So I think it could involve a lot of kicking of tires. That said, we could do it incrementally. We could work through it all module by module, and then remove the “/cgi-bin/koha” once we’re sure it’s not referenced anywhere. Kyle: I’m glad you like the idea. I’d like to use the same paths in Apache and Plack (for the sake of the self-referential URLs), so I was thinking “/opac/opac-detail.pl” and “/intranet/circ” (or “/intranet/circulation”). David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of Kyle Hall Sent: Tuesday, 19 May 2020 11:20 PM To: Owen Leonard <oleonard@myacpl.org> Cc: koha-devel <koha-devel@lists.koha-community.org> Subject: Re: [Koha-devel] How to make self-referential URLs in Koha I think that would also me a great cosmetic enhancement. At the risk of scope creep, we could go a step further by mapping the perl scripts to paths as well, so /cgi-bin/koha/circ/circulation-home.pl <http://circulation-home.pl> could become /circulation/home ( or even just /circulation ) for example. Kyle --- http://www.kylehall.info ByWater Solutions ( http://bywatersolutions.com ) Meadville Public Library ( http://www.meadvillelibrary.org ) Crawford County Federated Library System ( http://www.ccfls.org ) On Tue, May 19, 2020 at 9:08 AM Owen Leonard <oleonard@myacpl.org <mailto:oleonard@myacpl.org> > wrote:
In the past, I have wondered if we could get rid of “/cgi-bin/koha” as a path prefix all together
No idea what that would involve (other than search-and-replace in the templates), but from the user's point of view I think it would be a nice improvement. -- Owen -- Web Developer Athens County Public Libraries (740) 737-6006 https://www.myacpl.org _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
Did this ever become a bug? Looks like an interesting improvement and would be nice to see a start made? On Wed, 20 May 2020, 2:40 am , <dcook@prosentient.com.au> wrote:
So happy to see responses to this ^_^
Owen: It looks like we’d need to do a search and replace in the templates and the code. So I think it could involve a lot of kicking of tires. That said, we could do it incrementally. We could work through it all module by module, and then remove the “/cgi-bin/koha” once we’re sure it’s not referenced anywhere.
Kyle: I’m glad you like the idea. I’d like to use the same paths in Apache and Plack (for the sake of the self-referential URLs), so I was thinking “/opac/opac-detail.pl” and “/intranet/circ” (or “/intranet/circulation”).
David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St
Ultimo, NSW 2007
Australia
Office: 02 9212 0899
Online: 02 8005 0595
*From:* Koha-devel <koha-devel-bounces@lists.koha-community.org> *On Behalf Of *Kyle Hall *Sent:* Tuesday, 19 May 2020 11:20 PM *To:* Owen Leonard <oleonard@myacpl.org> *Cc:* koha-devel <koha-devel@lists.koha-community.org> *Subject:* Re: [Koha-devel] How to make self-referential URLs in Koha
I think that would also me a great cosmetic enhancement.
At the risk of scope creep, we could go a step further by mapping the perl scripts to paths as well, so /cgi-bin/koha/circ/circulation-home.pl could become /circulation/home ( or even just /circulation ) for example.
Kyle
---
http://www.kylehall.info ByWater Solutions ( http://bywatersolutions.com ) Meadville Public Library ( http://www.meadvillelibrary.org ) Crawford County Federated Library System ( http://www.ccfls.org )
On Tue, May 19, 2020 at 9:08 AM Owen Leonard <oleonard@myacpl.org> wrote:
In the past, I have wondered if we could get rid of “/cgi-bin/koha” as a path prefix all together
No idea what that would involve (other than search-and-replace in the templates), but from the user's point of view I think it would be a nice improvement.
-- Owen
-- Web Developer Athens County Public Libraries (740) 737-6006 https://www.myacpl.org _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
Nah, I don’t think that I ever created a Bugzilla issue for it. There’s pretty much 0 chance that I would work on it anyway. I just don’t have the time to devote to it. Sometimes I wonder how long it will take me to finish #26791 (which uses an /intranet/staff mount point in plack.psgi) since it’s a 100% personal project and I almost never code at home at the moment. Maybe I will when winter comes to the southern hemisphere heh. David Cook Software Engineer Prosentient Systems Suite 7.03 6a Glen St Milsons Point NSW 2061 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Renvoize, Martin <martin.renvoize@ptfs-europe.com> Sent: Thursday, 11 February 2021 8:55 AM To: David Cook <dcook@prosentient.com.au> Cc: koha-devel <koha-devel@lists.koha-community.org> Subject: Re: [Koha-devel] How to make self-referential URLs in Koha Did this ever become a bug? Looks like an interesting improvement and would be nice to see a start made? On Wed, 20 May 2020, 2:40 am , <dcook@prosentient.com.au <mailto:dcook@prosentient.com.au> > wrote: So happy to see responses to this ^_^ Owen: It looks like we’d need to do a search and replace in the templates and the code. So I think it could involve a lot of kicking of tires. That said, we could do it incrementally. We could work through it all module by module, and then remove the “/cgi-bin/koha” once we’re sure it’s not referenced anywhere. Kyle: I’m glad you like the idea. I’d like to use the same paths in Apache and Plack (for the sake of the self-referential URLs), so I was thinking “/opac/opac-detail.pl <http://opac-detail.pl> ” and “/intranet/circ” (or “/intranet/circulation”). David Cook Systems Librarian Prosentient Systems 72/330 Wattle St Ultimo, NSW 2007 Australia Office: 02 9212 0899 Online: 02 8005 0595 From: Koha-devel <koha-devel-bounces@lists.koha-community.org <mailto:koha-devel-bounces@lists.koha-community.org> > On Behalf Of Kyle Hall Sent: Tuesday, 19 May 2020 11:20 PM To: Owen Leonard <oleonard@myacpl.org <mailto:oleonard@myacpl.org> > Cc: koha-devel <koha-devel@lists.koha-community.org <mailto:koha-devel@lists.koha-community.org> > Subject: Re: [Koha-devel] How to make self-referential URLs in Koha I think that would also me a great cosmetic enhancement. At the risk of scope creep, we could go a step further by mapping the perl scripts to paths as well, so /cgi-bin/koha/circ/circulation-home.pl <http://circulation-home.pl> could become /circulation/home ( or even just /circulation ) for example. Kyle --- http://www.kylehall.info ByWater Solutions ( http://bywatersolutions.com ) Meadville Public Library ( http://www.meadvillelibrary.org ) Crawford County Federated Library System ( http://www.ccfls.org ) On Tue, May 19, 2020 at 9:08 AM Owen Leonard <oleonard@myacpl.org <mailto:oleonard@myacpl.org> > wrote:
In the past, I have wondered if we could get rid of “/cgi-bin/koha” as a path prefix all together
No idea what that would involve (other than search-and-replace in the templates), but from the user's point of view I think it would be a nice improvement. -- Owen -- Web Developer Athens County Public Libraries (740) 737-6006 https://www.myacpl.org _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/ _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
In this case in webserver config we base dynamic pages on the ".pl" extension. This is the case for example on the php projects I know. But then we must rename files in "svc" dirs with .pl. I'd be happy to test ;) Le 10/02/2021 à 22:54, Renvoize, Martin a écrit :
Did this ever become a bug? Looks like an interesting improvement and would be nice to see a start made?
On Wed, 20 May 2020, 2:40 am , <dcook@prosentient.com.au <mailto:dcook@prosentient.com.au>> wrote:
So happy to see responses to this ^_^____
__ __
Owen: It looks like we’d need to do a search and replace in the templates and the code. So I think it could involve a lot of kicking of tires. That said, we could do it incrementally. We could work through it all module by module, and then remove the “/cgi-bin/koha” once we’re sure it’s not referenced anywhere.____
__ __
Kyle: I’m glad you like the idea. I’d like to use the same paths in Apache and Plack (for the sake of the self-referential URLs), so I was thinking “/opac/opac-detail.pl <http://opac-detail.pl>” and “/intranet/circ” (or “/intranet/circulation”). ____
__ __
David Cook____
Systems Librarian____
Prosentient Systems____
72/330 Wattle St____
Ultimo, NSW 2007____
Australia____
__ __
Office: 02 9212 0899____
Online: 02 8005 0595____
__ __
*From:*Koha-devel <koha-devel-bounces@lists.koha-community.org <mailto:koha-devel-bounces@lists.koha-community.org>> *On Behalf Of *Kyle Hall *Sent:* Tuesday, 19 May 2020 11:20 PM *To:* Owen Leonard <oleonard@myacpl.org <mailto:oleonard@myacpl.org>> *Cc:* koha-devel <koha-devel@lists.koha-community.org <mailto:koha-devel@lists.koha-community.org>> *Subject:* Re: [Koha-devel] How to make self-referential URLs in Koha____
__ __
I think that would also me a great cosmetic enhancement.____
__ __
At the risk of scope creep, we could go a step further by mapping the perl scripts to paths as well, so /cgi-bin/koha/circ/circulation-home.pl <http://circulation-home.pl> could become /circulation/home ( or even just /circulation ) for example.____
__ __
Kyle____
__ __
---____
http://www.kylehall.info <http://www.kylehall.info> ByWater Solutions ( http://bywatersolutions.com <http://bywatersolutions.com> ) Meadville Public Library ( http://www.meadvillelibrary.org <http://www.meadvillelibrary.org> ) Crawford County Federated Library System ( http://www.ccfls.org <http://www.ccfls.org> )____
__ __
__ __
On Tue, May 19, 2020 at 9:08 AM Owen Leonard <oleonard@myacpl.org <mailto:oleonard@myacpl.org>> wrote:____
> In the past, I have wondered if we could get rid of “/cgi-bin/koha” as a path prefix all together
No idea what that would involve (other than search-and-replace in the templates), but from the user's point of view I think it would be a nice improvement.
-- Owen
-- Web Developer Athens County Public Libraries (740) 737-6006 https://www.myacpl.org <https://www.myacpl.org> _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel <https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel> website : http://www.koha-community.org/ <http://www.koha-community.org/> git : http://git.koha-community.org/ <http://git.koha-community.org/> bugs : http://bugs.koha-community.org/ <http://bugs.koha-community.org/>____
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel <https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel> website : http://www.koha-community.org/ <http://www.koha-community.org/> git : http://git.koha-community.org/ <http://git.koha-community.org/> bugs : http://bugs.koha-community.org/ <http://bugs.koha-community.org/>
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/
-- Fridolin SOMERS <fridolin.somers@biblibre.com> Software and system maintainer 🦄 BibLibre, France
Hi Frido, That's an interesting point. I was thinking that we'd just replace "/cgi-bin/koha" with a different base path (like "/opac" and "/intranet"). If we didn't do that (after all "/opac" and "/intranet" are still ugly), then I suppose we would need some other mechanism (like file extension) to enable CGI execution. Even with Plack... if we wanted the reverse proxy to serve the static assets, we'd need some way of knowing which requests to proxy to Starman... But you could turn on proxy/CGI for everything *except* requests to "intranet-tmpl" and "opac-tmpl" using Location or LocationMatch directives for instance. The static assets already have that base path, so that provides a nice hook. I've just finished restructuring an old PHP project, so I do have URL paths and file locations on my mind. I'm not using Laravel, but with Laravel you put your index.php and static assets into the "/public" directory and use that as your web app root. Then you tell it to use index.php as a FastCGI app. Hmm... here's an interesting snippet from the internet for Apache (looking for equivalents of Nginx's try_files): RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://app_cluster%{REQUEST_URI} [P,QSA,L] Anyway, there are certainly options. David Cook Software Engineer Prosentient Systems Suite 7.03 6a Glen St Milsons Point NSW 2061 Australia Office: 02 9212 0899 Online: 02 8005 0595 -----Original Message----- From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of Fridolin SOMERS Sent: Friday, 12 February 2021 2:52 AM To: koha-devel@lists.koha-community.org Subject: Re: [Koha-devel] How to make self-referential URLs in Koha In this case in webserver config we base dynamic pages on the ".pl" extension. This is the case for example on the php projects I know. But then we must rename files in "svc" dirs with .pl. I'd be happy to test ;) Le 10/02/2021 à 22:54, Renvoize, Martin a écrit :
Did this ever become a bug? Looks like an interesting improvement and would be nice to see a start made?
On Wed, 20 May 2020, 2:40 am , <dcook@prosentient.com.au <mailto:dcook@prosentient.com.au>> wrote:
So happy to see responses to this ^_^____
__ __
Owen: It looks like we’d need to do a search and replace in the templates and the code. So I think it could involve a lot of kicking of tires. That said, we could do it incrementally. We could work through it all module by module, and then remove the “/cgi-bin/koha” once we’re sure it’s not referenced anywhere.____
__ __
Kyle: I’m glad you like the idea. I’d like to use the same paths in Apache and Plack (for the sake of the self-referential URLs), so I was thinking “/opac/opac-detail.pl <http://opac-detail.pl>” and “/intranet/circ” (or “/intranet/circulation”). ____
__ __
David Cook____
Systems Librarian____
Prosentient Systems____
72/330 Wattle St____
Ultimo, NSW 2007____
Australia____
__ __
Office: 02 9212 0899____
Online: 02 8005 0595____
__ __
*From:*Koha-devel <koha-devel-bounces@lists.koha-community.org <mailto:koha-devel-bounces@lists.koha-community.org>> *On Behalf Of *Kyle Hall *Sent:* Tuesday, 19 May 2020 11:20 PM *To:* Owen Leonard <oleonard@myacpl.org <mailto:oleonard@myacpl.org>> *Cc:* koha-devel <koha-devel@lists.koha-community.org <mailto:koha-devel@lists.koha-community.org>> *Subject:* Re: [Koha-devel] How to make self-referential URLs in Koha____
__ __
I think that would also me a great cosmetic enhancement.____
__ __
At the risk of scope creep, we could go a step further by mapping the perl scripts to paths as well, so /cgi-bin/koha/circ/circulation-home.pl <http://circulation-home.pl> could become /circulation/home ( or even just /circulation ) for example.____
__ __
Kyle____
__ __
---____
http://www.kylehall.info <http://www.kylehall.info> ByWater Solutions ( http://bywatersolutions.com <http://bywatersolutions.com> ) Meadville Public Library ( http://www.meadvillelibrary.org <http://www.meadvillelibrary.org> ) Crawford County Federated Library System ( http://www.ccfls.org <http://www.ccfls.org> )____
__ __
__ __
On Tue, May 19, 2020 at 9:08 AM Owen Leonard <oleonard@myacpl.org <mailto:oleonard@myacpl.org>> wrote:____
> In the past, I have wondered if we could get rid of “/cgi-bin/koha” as a path prefix all together
No idea what that would involve (other than search-and-replace in the templates), but from the user's point of view I think it would be a nice improvement.
-- Owen
-- Web Developer Athens County Public Libraries (740) 737-6006 https://www.myacpl.org <https://www.myacpl.org> _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel <https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel> website : http://www.koha-community.org/ <http://www.koha-community.org/> git : http://git.koha-community.org/ <http://git.koha-community.org/> bugs : http://bugs.koha-community.org/ <http://bugs.koha-community.org/>____
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org <mailto:Koha-devel@lists.koha-community.org> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel <https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel> website : http://www.koha-community.org/ <http://www.koha-community.org/> git : http://git.koha-community.org/ <http://git.koha-community.org/> bugs : http://bugs.koha-community.org/ <http://bugs.koha-community.org/>
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/
-- Fridolin SOMERS <fridolin.somers@biblibre.com> Software and system maintainer 🦄 BibLibre, France _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/
On Wed, 10 Feb 2021 at 18:55, Renvoize, Martin < martin.renvoize@ptfs-europe.com> wrote:
Did this ever become a bug? Looks like an interesting improvement and would be nice to see a start made?
Bug 18410 – Koha should use cool URIs <https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18410>?
participants (6)
-
dcook@prosentient.com.au -
Fridolin SOMERS -
Kyle Hall -
Owen Leonard -
Pablo Bianchi -
Renvoize, Martin