-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an Accept header for manifests #3770
base: master
Are you sure you want to change the base?
Conversation
Our IIIF server provides v2 APIs by default, but if the client provides an Accept header with the v3 profile, it will provide a v3 response. This triggers that behavior.
Warning: I just tried to implement this in my own application, and it seems to break compatibility with some IIIF endpoints, most notably that of the Vatican. The reason for this is, that by setting the Example: https://digi.vatlib.it/iiif/MSS_Arch.Cap.S.Pietro.C.132/manifest.json Fetches fine without the |
@jbaiter can you give me more details about this? I'm not seeing this behavior in a simple test: <!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
const run = async function () {
const url = 'https://digi.vatlib.it/iiif/MSS_Arch.Cap.S.Pietro.C.132/manifest.json'
console.log('fetch with no headers')
const result = await fetch(url)
console.log("done")
console.log(result)
console.log('fetch with headers')
const result2 = await fetch(url, { Accept: 'application/ld+json, application/json' })
console.log("done")
console.log(result2.json())
console.log('fetch with headers')
const result3 = await fetch(url, { Accept: 'application/ld+json;q=0.9;profile="http://iiif.io/api/presentation/3/context.json", application/ld+json;q=0.7;profile="http://iiif.io/api/presentation/2/context.json"'})
console.log("done")
console.log(result3.json())
}
run()
</script>
<p>Look in the console</p>
</body>
</html> |
Gotcha, I found out why my code was triggering the preflight request: I was using a |
Sorry, but turns out that wasn't it, I'm seeing the same result with native I think your sample code is not actually setting the https://kk7jk2.csb.app/ |
I think we're running into this:
https://fetch.spec.whatwg.org/#cors-safelisted-request-header
-- edit1: Nope, that's not it either (see updated sandbox).
If you ask me, this looks like a bug in the browser. the The main problem here is ofc that the Vatican IIIF implementation is broken since it does not implement the CORS protocol as mandated by the spec, but still, M3 should probably strife for maximum compatibility. -- edit2: Scratch all of the above, I wasn't reading the
The quotes around the profile value are optional, |
I don't have anything really useful to contribute but @jbaiter isn't is a semicolon |
Our IIIF server provides v2 APIs by default, but if the client provides an Accept header with the v3 profile, it will provide a v3 response. This triggers that behavior.