Page MenuHomePhabricator

Un-proxy URLs before fetching data
Closed, DuplicatePublic

Description

When users access content through the Library-Card-Platform proxy server, their URL is overwritten to be a proxied version of the 'real' URL. For example, to access the JSTOR article at https://www.jstor.org/stable/26513819, a user will actually be at https://www-jstor-org.wikipedialibrary.idm.oclc.org/stable/26513819.

If the editor attempts to add this URL to a citation via Citoid, the tool ends up on the Meta login page and adds the entirely wrong metadata:

Screenshot 2021-03-17 at 12.11.45.png (390×115 px, 19 KB)

Whereas they would expect the following result, as with the 'real' URL:

Screenshot 2021-03-17 at 12.10.52.png (389×156 px, 30 KB)

The process of un-proxying this URL is to remove .wikipedialibrary.idm.oclc.org and convert all - to . in the preceding section of the URL.* Citoid could do this if it detects the URL is a proxied one before fetching metadata. It could then use the un-proxied URL in the citation too, instead of a URL that only certain readers (active Wikipedia editors) can access.

This isn't just a problem for The Wikipedia Library, as any library accessing content via a proxy will have the same issue.

*This does, of course, incorrectly handle the edge case of URLs which are supposed to have dashes. It's still probably a better situation to be in than 100% of these failing.

Event Timeline

Samwalton9-WMF updated the task description. (Show Details)
Samwalton9-WMF added a subscriber: DerHexer.

Is there any reason the Wikipedia library can't just redirect these urls itself to the unproxied url if it's a bot instead of a logged in user? (You could check user agent string you could use if you want to make an exception just for us- it's "Citoid (Wikimedia tool; learn more at https://www.mediawiki.org/wiki/Citoid)") .

This isn't just a problem for The Wikipedia Library, as any library accessing content via a proxy will have the same issue.

But the URL will be different, no? Is it part of a wider proxy scheme (is it EZproxy?) that would easy to remove? How would we know for a generic URL is proxied or not? (What if we have a url with dashes in it that is not a proxy?)

I had a google here about this in the Zotero connector (which is browser based, but still relevant, because apparently it's not that easy to do in the general use case: https://forums.zotero.org/discussion/79153/help-with-oxford-exproxy-settings-for-zotero-connector) From there it looks like the ezproxy uses a totally different url scheme with no dashes... I'm not sure how generalisable we could make this?

You caught us right in our engineering meeting so we just chatted about this :)

Is there any reason the Wikipedia library can't just redirect these urls itself to the unproxied url if it's a bot instead of a logged in user? (You could check user agent string you could use if you want to make an exception just for us- it's "Citoid (Wikimedia tool; learn more at https://www.mediawiki.org/wiki/Citoid)") .

Yes, this is a possibility - we talked about two options, one whereby we simply do the redirect as suggested (either all bots or Citoid specifically), and one where we include a header with the 'real' URL which Citoid could then be updated to use. Since Citoid seems to ultimately add the destination URL rather than whatever the user input, going the redirect route seems more sensible. We don't entirely understand what's feasible in EZProxy just yet, so we'll need to do some investigation before we decide exactly how this would work.

How would we know for a generic URL is proxied or not?
it looks like the ezproxy uses a totally different url scheme with no dashes... I'm not sure how generalisable we could make this?

Yeah this is totally right, I had a naive understanding of this. We both wouldn't have a good way to understand that a URL is proxied, and the process for converting the URL is lossy due to the dashes issue. So doing this conversion without any input from EZProxy about where the intended destination was isn't a great idea.

I recently noticed the Zotero connectors (the browser extension, so not what we use) has an "unproxify" function:

https://github.com/zotero/zotero-connectors/blob/master/src/common/proxy.js

Since they are a browser extension, they can both a) store the original proxy url and b) use this to unproxy the url and c) get the metadata from the page (because the browser has the auth tokens to navigate)

Certainly we could authenticate citoid to log into the Wikipedia library, then it's possible. Not sure how the partners would feel about that. Or EZProxy.

How would we know for a generic URL is proxied or not?
it looks like the ezproxy uses a totally different url scheme with no dashes... I'm not sure how generalisable we could make this?

Yeah this is totally right, I had a naive understanding of this. We both wouldn't have a good way to understand that a URL is proxied, and the process for converting the URL is lossy due to the dashes issue. So doing this conversion without any input from EZProxy about where the intended destination was isn't a great idea.

I'm revisiting this ticket and confused about what I was saying here. We would know a URL is proxied via EZProxy because it would contain ".idm.oclc.org" in the URL.