[Bug 24369] New: Add ability to set CORS header in Koha
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Bug ID: 24369 Summary: Add ability to set CORS header in Koha Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org The reports API can produce JSON that would be useful on other library related websites, but the use of it appears to be blocked by default via CORS. It would be nice if there were a Koha syspref to set the CORS header rather than mucking about with htaccess files and whatnot. -- 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=24369 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- There are two APIs actually that could benefit from this: - /svc - /api/v1 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 97092 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97092&action=edit Bug 24369: Add AccessControlAllowOrigin syspref -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 97093 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97093&action=edit Bug 24369: Add CORS support to output_with_http_headers() This patch adds CORS support to output_with_headers(). It will use the AccessControlAllowOrigin syspref to pick the value and set the Access-Control-Allow-Origin header. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Output.t SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 97094 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97094&action=edit Bug 24369: Add CORS support to the API This patch adds CORS support for API requests. It uses the AccessControlAllowOrigin syspref. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth.t => SUCCESS: Tests pass! 3. Set the AccessControlAllowOrigin to any string (for example, *) 4. Use any API testing tool (Postman?) to place a request on the API => SUCCESS: The response headers include Access-Control-Allow-Origin, containing what you set on the syspref 5. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |benjamin.rokseth@deichman.n | |o, | |martin.renvoize@ptfs-europe | |.com Text to go in the| |This development adds release notes| |support for setting the | |Access-Control-Allow-Origin | |header in Koha. This is | |specially useful for | |integrating data from the | |services provided by Koha | |on sites other than Koha | |itself. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24384 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24384 [Bug 24384] Add Access-Control-Allow-Origin support to reports svc -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew.isherwood@ptfs-europ | |e.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #97092|0 |1 is obsolete| | --- Comment #5 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Created attachment 97298 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97298&action=edit Bug 24369: Add AccessControlAllowOrigin syspref Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #97093|0 |1 is obsolete| | --- Comment #6 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Created attachment 97299 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97299&action=edit Bug 24369: Add CORS support to output_with_http_headers() This patch adds CORS support to output_with_headers(). It will use the AccessControlAllowOrigin syspref to pick the value and set the Access-Control-Allow-Origin header. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Output.t SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #97094|0 |1 is obsolete| | --- Comment #7 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Created attachment 97300 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97300&action=edit Bug 24369: Add CORS support to the API This patch adds CORS support for API requests. It uses the AccessControlAllowOrigin syspref. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth.t => SUCCESS: Tests pass! 3. Set the AccessControlAllowOrigin to any string (for example, *) 4. Use any API testing tool (Postman?) to place a request on the API => SUCCESS: The response headers include Access-Control-Allow-Origin, containing what you set on the syspref 5. Sign off :-D Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #97298|0 |1 is obsolete| | Attachment #97299|0 |1 is obsolete| | Attachment #97300|0 |1 is obsolete| | --- Comment #8 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 100144 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=100144&action=edit Bug 24369: Add AccessControlAllowOrigin syspref Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 100145 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=100145&action=edit Bug 24369: Add CORS support to output_with_http_headers() This patch adds CORS support to output_with_headers(). It will use the AccessControlAllowOrigin syspref to pick the value and set the Access-Control-Allow-Origin header. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Output.t SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 --- Comment #10 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 100146 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=100146&action=edit Bug 24369: Add CORS support to the API This patch adds CORS support for API requests. It uses the AccessControlAllowOrigin syspref. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/auth.t => SUCCESS: Tests pass! 3. Set the AccessControlAllowOrigin to any string (for example, *) 4. Use any API testing tool (Postman?) to place a request on the API => SUCCESS: The response headers include Access-Control-Allow-Origin, containing what you set on the syspref 5. Sign off :-D Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #12 from David Cook <dcook@prosentient.com.au> --- Interesting approach! I was surprised you didn't handle it at the reverse proxy level, but interesting to allow libraries to configure their own header. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 --- Comment #13 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to David Cook from comment #12)
Interesting approach! I was surprised you didn't handle it at the reverse proxy level, but interesting to allow libraries to configure their own header.
On small shops, it's easier to just carry the config from the DB and use stock configurations for the rest of the stack. Power to the users! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 --- Comment #14 from David Cook <dcook@prosentient.com.au> --- (In reply to Tomás Cohen Arazi from comment #13)
On small shops, it's easier to just carry the config from the DB and use stock configurations for the rest of the stack. Power to the users!
Yeah it's interesting! Honestly, the more time goes by, the more carrying config from the DB makes sense. Much easier than trying to mess with a bunch of files. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joy@bywatersolutions.com --- Comment #15 from Joy Nelson <joy@bywatersolutions.com> --- enhancement not backported to 19.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|This development adds |This development adds release notes|support for setting the |support for setting the |Access-Control-Allow-Origin |Access-Control-Allow-Origin |header in Koha. This is |header in Koha using the |specially useful for |new |integrating data from the |AccessControlAllowOrigin |services provided by Koha |system preference. This is |on sites other than Koha |specially useful for |itself. |integrating data from the | |services provided by Koha | |on sites other than Koha | |itself. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |new feature QA Contact|testopia@bugs.koha-communit | |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|Architecture, internals, |Web services |and plumbing | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|This development adds |This development adds release notes|support for setting the |support for setting the |Access-Control-Allow-Origin |Access-Control-Allow-Origin |header in Koha using the |header in Koha using the |new |new |AccessControlAllowOrigin |AccessControlAllowOrigin |system preference. This is |system preference. This is |specially useful for |especially useful for |integrating data from the |integrating data from the |services provided by Koha |services provided by Koha |on sites other than Koha |on sites other than Koha |itself. |itself. | | | |**New system | |preference**: | |`AccessControlAllowOrigin` | |defaults to empty. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24369 Andrew Isherwood <bugzilla@warmlight.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|bugzilla@warmlight.co.uk | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org