Bug 24384 - Add Access-Control-Allow-Origin support to OPAC reports svc
Summary: Add Access-Control-Allow-Origin support to OPAC reports svc
Status: Pushed to master
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 24369
Blocks:
  Show dependency treegraph
 
Reported: 2020-01-09 14:27 UTC by Tomás Cohen Arazi
Modified: 2020-05-20 09:43 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Using the foundations laid with bug 24369 this enhancement allows the CORS headers to be set on the OPAC Reports SVC routes.
Version(s) released in:
20.05.00


Attachments
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc (1.47 KB, patch)
2020-01-09 14:49 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc (1.52 KB, patch)
2020-03-15 19:19 UTC, David Nind
Details | Diff | Splinter Review
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc (1.57 KB, patch)
2020-03-16 11:09 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2020-01-09 14:27:30 UTC

    
Comment 1 Tomás Cohen Arazi 2020-01-09 14:49:34 UTC
Created attachment 97095 [details] [review]
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc

This patch makes the opac/svc/report script use output_with_http_headers
so it sets the Access-Control-Allow-Origin header.

To test:
1. Create a new public report and remember the report id
2. Use your favourite too to fetch the report in JSON by issuing:
   GET http://localhost:8080/cgi-bin/koha/svc/report?id=1
=> FAIL: There is no Access-Control-Allow-Origin header
3. Apply this patch
4. Restart Plack
   $ sudo koha-plack --restart kohadev
5. Set the AccessControlAllowOrigin to anything (for example,
   https://koha-community.org)
6. Repeat 2
=> SUCCESS: On the response headers you find
Access-Control-Allow-Origin: https://koha-community.org
7. Sign off :-D
Comment 2 David Nind 2020-03-15 19:19:27 UTC
Created attachment 100705 [details] [review]
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc

This patch makes the opac/svc/report script use output_with_http_headers
so it sets the Access-Control-Allow-Origin header.

To test:
1. Create a new public report and remember the report id
2. Use your favourite too to fetch the report in JSON by issuing:
   GET http://localhost:8080/cgi-bin/koha/svc/report?id=1
=> FAIL: There is no Access-Control-Allow-Origin header
3. Apply this patch
4. Restart Plack
   $ sudo koha-plack --restart kohadev
5. Set the AccessControlAllowOrigin to anything (for example,
   https://koha-community.org)
6. Repeat 2
=> SUCCESS: On the response headers you find
Access-Control-Allow-Origin: https://koha-community.org
7. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Nick Clemens 2020-03-16 11:09:44 UTC
Created attachment 100732 [details] [review]
Bug 24384: Add Access-Control-Allow-Origin support to OPAC reports svc

This patch makes the opac/svc/report script use output_with_http_headers
so it sets the Access-Control-Allow-Origin header.

To test:
1. Create a new public report and remember the report id
2. Use your favourite too to fetch the report in JSON by issuing:
   GET http://localhost:8080/cgi-bin/koha/svc/report?id=1
=> FAIL: There is no Access-Control-Allow-Origin header
3. Apply this patch
4. Restart Plack
   $ sudo koha-plack --restart kohadev
5. Set the AccessControlAllowOrigin to anything (for example,
   https://koha-community.org)
6. Repeat 2
=> SUCCESS: On the response headers you find
Access-Control-Allow-Origin: https://koha-community.org
7. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Martin Renvoize 2020-03-19 09:23:39 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 5 Joy Nelson 2020-04-03 20:27:09 UTC
not backported to 19.11.x due to dependencies