librisxl
librisxl copied to clipboard
Redirect root context ref to systemContextUri
[Untested Draft]
Currently, we're not serving working JSON-LD, since the /context.jsonld reference used both in the embedded @context
reference:
curl -s -L -HAccept:application/ld+json https://libris.kb.se/fxql7jqr38b1dkf
and the Linke header variant served for plain JSON:
curl -v -HAccept:application/json https://libris.kb.se/fxql7jqr38b1dkf
< link: </context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
(This was pointed out during the BIBFRAME conference.)
This Untested Draft PR simply redirects to the chosen system context, from the previously working "convenience" URI (the root /context.jsonld resource; i.e. resolving to either https://libris.kb.se/context.jsonld and https://id.kb.se/context.jsonld).
If you so decide, it could set the whelk.systemContextUri directly (it's not as "nice", but more explicit, and may be easier depending on web server configuration complexity).
Ouch! This looks fine to me but wouldn't itself solve the issue because https://libris.kb.se/context.jsonld is passed to websok anyway. id.kb.se's nginx has this:
location = /context.jsonld {
proxy_pass http://xl-api-cluster/https://id.kb.se/vocab/context/data.jsonld;
}
Should simply add the same to libris.kb.se's nginx, no? Then we can fix the issue immediately. We used to have the equivalent in the Apache config but it got lost in the migration. I'll add some tests to https://github.com/libris/lxl_api_tests.
Ah; yes; adding that would fix this right now, which would be great! Then we can proceed to solve this properly in this PR (to avoid too much domain logic in nginx)? And :100: :+1: for tests!