Islandora / islandora_mirador

Use the Mirador viewer with your Islandora site.
https://www.drupal.org/project/islandora_mirador
GNU General Public License v2.0
3 stars 10 forks source link

[BUG] forcing Mirador viewer to use https #51

Open rbos opened 2 months ago

rbos commented 2 months ago

Hi,

I'm having trouble getting Mirador to play nicely with our load balancer. With various tweaks, I've gotten it to the point where it'll request the HTTP version of a tile, like

http://EXAMPLE/cantaloupe/iiif/2/http%3A%2F%EXAMPLE%2F_flysystem%2Ffedora%2F2024-08%2FMSC130-1030_01.tif/full/225,/0/default.jpg

which our load-balancer unfortunately interpolates during redirect, un-decoding the URL in the process:

https://EXAMPLE/cantaloupe/iiif/2/http:/EXAMPLE/_flysystem/fedora/2024-08/MSC130-1030_01.tif/full/225,/0/default.jpg

But if I change http to https in the first url, like so:

https://EXAMPLE/cantaloupe/iiif/2/http%3A%2F%EXAMPLE%2F_flysystem%2Ffedora%2F2024-08%2FMSC130-1030_01.tif/full/225,/0/default.jpg

the tile will render.

I notice that Mirador has buried in its code a "forceHttps" option that looks like it should be usable. How would I activate that in the Islandora module?

kayakr commented 2 months ago

I notice that Mirador has buried in its code a "forceHttps" option that looks like it should be usable. How would I activate that in the Islandora module?

@rbos forceHttps is part of "normalize-url" https://www.npmjs.com/package/normalize-url that mirador depends on, so I'm not sure if there is anyway to target it. I see that Mirador offers some preprocess functions that might be able to rewrite the URL? https://github.com/ProjectMirador/mirador/blob/master/src/config/settings.js#L447

kayakr commented 2 months ago

@rbos fyi, normalizeUrl() called in 2 places; you might be able to tweak that directly and see if you get the behaviour you want... https://github.com/search?q=repo%3AProjectMirador%2Fmirador%20normalizeUrl&type=code

rbos commented 2 months ago

Thanks. I guess I can fork a copy of the js file we're pulling in and make a few changes.