Pkp-lib: Subscribers can't access PDF.js via EZProxy due to URL encoding

Created on 21 Oct 2019  路  9Comments  路  Source: pkp/pkp-lib

First of all, I want to make it clear that reports of PDF.js throwing an error when proxied were common pre-3.1.2. This was due to the host name discrepancy and could be fixed by adding DJ or HJ directives to subsciber's EZProxy stanzas as suggested in this Forum thread.

PDFjs error

In OJS 3.1.2 the behaviour of PDF.js plugin changed (possibly with plugin version update from v1 to v2?). It now encodes a portion of the URL, which means that EZProxy is thrown off on its way to the article URL.

PDFjs via EZProxy

To replicate the issues, test a journal URL as a subcriber via EZproxy and look at the source code.

I expect this would affect all EZProxy subscribers of OJS 3.1.2 journals.

A hacky workaround which we have tested at our institution, is to add a find-and-replace for the encoded portion to the EZProxy config. However this would need to be done by each subscriber, unless the publisher includes this in the OCLC's stanza database.

A preferred solution would be for the PDF.js plugin to not encode the portion of the URL.

Hosting

All 9 comments

@librariam, I've taken a scan over the OJS 3.1.1 to 3.1.2 changes that would be relevant to the PDF viewer (particularly the inclusion of the PDF URL in the file URL parameter) and I don't see any changes that would account for what you describe; both OJS 3.1.1 and 3.1.2 should be presenting URLs in URL parameters in encoded (https%3A%2F%2F) forms. Is it possible that there was a modification in your OJS 3.1.1 code that didn't get migrated into the OJS 3.1.2 code?

@asmecher I'm seeing the same behaviour in a journal hosted by PKP as well, to which we at UTL have a subscription:

<iframe src="https://www-foodsystemsjournal-org.myaccess.library.utoronto.ca/plugins/generic/pdfJsViewer/pdf.js/web/viewer.html?file=https%3A%2F%2Fwww.foodsystemsjournal.org%2Findex.php%2Ffsj%2Farticle%2Fdownload%2F694%2F680%2F" width="100%" height="100%" style="min-height: 500px;" allowfullscreen="" webkitallowfullscreen=""></iframe>

I've noticed from my older screenshots that PDF.js went from v1.8.188 to v.2.0.943 (based on what's reported in the error) - could that be the issue?

@librariam, the URLthat gets provided to viewer.html is constructed purely on the OJS side of things (before it gets handed off to PDF.js), so an update to the PDF.js library wouldn't have any effect there.

@librariam do you have an example of the Find and Replace line for EZproxy that you could share?

Nevermind, found an example that works:

Find jps.library.utoronto.ca
Replace ^sjps.library.utoronto.ca^

This is from https://help.oclc.org/Library_Management/EZproxy/Database_stanzas/iter

Hi @asmecher and @NateWr, confirming that this continues to be a reported issue for hosted journals running stock OJS 3.2.1. If there's any additional info that we can provide to help track this down please let me know.

See: https://github.com/pkp/pkp-lib/issues/6246

This has just been merged for release in OJS/OMP/OPS 3.2.1-2. Meanwhile, the patch at the link above is worth a look.

Thanks @asmecher!

I have a similar problem with the PDF viewer, I am Spanish, when I enter from Spain everything is correct, but when they enter from outside the pdf viewer throws error 403.

@aluquerivas-dev, if you're looking for help debugging this, could you post on our support forum (https://forum.pkp.sfu.ca) with details about which of our applications you're using, what version, etc?

Was this page helpful?
0 / 5 - 0 ratings