Bug 14523 - Google jackets being blocked when OPAC using HTTPS
Summary: Google jackets being blocked when OPAC using HTTPS
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Barry Cannon
QA Contact: Testopia
URL:
Keywords:
: 13527 (view as bug list)
Depends on:
Blocks: 17137
  Show dependency treegraph
 
Reported: 2015-07-13 09:55 UTC by Barry Cannon
Modified: 2017-06-14 22:15 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Change Google books URL from HTTP to HTTPS (1.69 KB, patch)
2015-07-14 11:32 UTC, Barry Cannon
Details | Diff | Splinter Review
Checks current URL and connects to appropriate google resource (2.10 KB, patch)
2016-01-28 12:11 UTC, Barry Cannon
Details | Diff | Splinter Review
Corrects problem with https sites accessing google jackets (1.83 KB, patch)
2016-02-01 11:38 UTC, Barry Cannon
Details | Diff | Splinter Review
Bug 14523 - Google jackets being blocked when OPAC using HTTPS (1.93 KB, patch)
2016-02-01 12:39 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 14523 - Google jackets being blocked when OPAC using HTTPS (1.83 KB, patch)
2016-02-01 15:52 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 14523 - Google jackets being blocked when OPAC using HTTPS (2.04 KB, patch)
2016-02-02 10:31 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Barry Cannon 2015-07-13 09:55:41 UTC
Google jackets are not displayed in OPAC if site is configured to server HTTPS. It looks like the google-jackets.js file is hard coded to request the content via HTTP. Most browsers will block this mixed content. Changing the google-jackets.js to "https://books.google.com" resolves the problems - and displays the image correctly. Maybe we should pass another variable to GetCoverFromIsbn() specifying if we are using HTTPS or not?
Comment 1 Barry Cannon 2015-07-14 11:32:18 UTC Comment hidden (obsolete)
Comment 2 Frédéric Demians 2015-11-11 13:54:29 UTC
Wouldn't it better to detect in JavaScript the protocol used to serve the page? using window.location.protocol.
Comment 3 Barry Cannon 2016-01-28 12:11:00 UTC Comment hidden (obsolete)
Comment 4 Frédéric Demians 2016-01-28 13:21:16 UTC
Seems OK to me, except that you're creating a 'prefix' variable which pollutes the Javascript global namespace. Your variable name could potentially be used elsewhere by another JS portion of code. You should rather use directly location.protocol.
Comment 5 Barry Cannon 2016-02-01 11:38:46 UTC Comment hidden (obsolete)
Comment 6 Frédéric Demians 2016-02-01 12:39:54 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2016-02-01 15:04:22 UTC
On bug 14571, we always use https for the amazon images, it would make sense to do the same here.
Comment 8 Frédéric Demians 2016-02-01 15:17:43 UTC
(In reply to Jonathan Druart from comment #7)
> On bug 14571, we always use https for the amazon images, it would make sense
> to do the same here.

You're correct. If Google Books is requested exclusively in https, it works. If the OPAC is HTTP, there isn't 'mixed content' error. And if the OPAC is HTTPS, there isn't anymore 'mixed content' error since OPAC and Google Books are requested with https.

Barry: would you mind modifying your patch to request Google Books in https, whatever the OPAC protocol? I can do it if you prefer.
Comment 9 Barry Cannon 2016-02-01 15:36:13 UTC
My very first patch on this thread, 40988, did exactly that! Can that be re-used?
Comment 10 Frédéric Demians 2016-02-01 15:52:33 UTC Comment hidden (obsolete)
Comment 11 Frédéric Demians 2016-02-01 15:53:07 UTC
(In reply to Barry Cannon from comment #9)
> My very first patch on this thread, 40988, did exactly that! Can that be
> re-used?

Yes! Done.
Comment 12 Jonathan Druart 2016-02-02 10:31:33 UTC
Created attachment 47544 [details] [review]
Bug 14523 - Google jackets being blocked when OPAC using HTTPS

This patch changes the Google jackets URL to use HTTPS instead of HTTP.

Test Plan:
1) Enable Google Jackets
2) Ensure the Koha OPAC instance is configued to use HTTPS
3) Confirm Google jackets display correctly.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Owen Leonard 2016-02-02 19:04:06 UTC
*** Bug 13527 has been marked as a duplicate of this bug. ***
Comment 14 Kyle M Hall 2016-02-26 14:16:57 UTC
Pushed to master! Should be in Koha 3.24, thanks Barry!
Comment 15 Amit 2016-12-03 08:47:10 UTC
How google-jackets.js can be used to fetch images in php