Kompakkt / Kompakkt/Viewer

Failure to load IIIF manifest from URL in updated-iiii-demo branch

Open
#62 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
17
Forks
4
PR merge metrics
No merged PRs in 30d

Description

The website viewer at https://blacklodge.hki.uni-koeln.de/viewer is not loading IIIF manifests directly from the manifest URL, but does work with the manifest text encodided in a data sheme URL; I see the same behavior working with a webpage served up with local copy of the code in the updated-iiif-demo branch.

In network console, working with a manifest on Amazon S3, at https://spri-open-resources.s3.us-east-2.amazonaws.com/Leeds2025Demo/astronaut_saxaphone_no_camera.json , I see a type 403 error on the fetch for the manifest, associated with CORS restriction. However this URL is loaded by other manifest viewers as well as passing CORS tests.

It looks like the 403 status code is being returned by the HTTP OPTIONS preflight call made by the kompakkt viewer; and that OPTIONS call is being made because of the way the fetch call is invoked in the processing.service.ts file at line 376.

Making the code patch as described:
```
--- a/src/app/services/processing/processing.service.ts
+++ b/src/app/services/processing/processing.service.ts
@@ -373,12 +373,7 @@ export class ProcessingService {
}

private async loadIIIF3DManifest(manifestUrl: string) {
- const manifestJson = await fetch(decodeURIUntilStable(manifestUrl), {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
+ const manifestJson = await fetch(decodeURIUntilStable(manifestUrl), {})
.then(res => res.json() as object)
.catch(error => {
console.log('Error loading manifest:', error);

```
in my local copy did allow the page to directly load the manifest, at least for these two test cases, on two different servers:

```
http://localhost:4200/?locale=en&standalone=true&manifest=https://spri-open-resources.s3.us-east-2.amazonaws.com/Leeds2025Demo/astronaut_saxaphone_no_camera.json

http://localhost:4200/?locale=en&standalone=true&manifest=https://gautschr.github.io/3D-modelling/iiif-manifests/poolcomplex/pool.json

```
I did not submit this as a pull request because the patch could be regarded as a circumvention of the CORS specs, as I understand them as described at

[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS)
[preflight request](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request)

and the correct solution would be for the servers to accept the pre-flight request. So this is submitted as a possible explanation for the behavior of the page.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/app/services/processing/processing.service.ts around line 376 and reproduce the manifest-loading failure with the two example URLs. Compare the current fetch behavior with the proposed change, then verify that direct IIIF manifest URLs load without the observed preflight failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.