Closed barbender closed 7 years ago
The cloud reader seem to request manifest.json/META-INF/container.xml
, which implies that the URL pointing to manifest.json
was detected with the wrong Content-Type
(HTTP header). Perhaps the HEAD
request that ReadiumJS uses to find out the Content-Type
does not work with cached responses?
I'm going to explicitly add the HEAD
method in the HTTP CORS config, to see if it helps:
https://github.com/edrlab/r2-streamer-js/blob/develop/src/server.ts#L90
public setResponseCORS(res: express.Response) {
res.setHeader("Access-Control-Allow-Origin",
"*");
res.setHeader("Access-Control-Allow-Methods",
"GET, OPTIONS"); // POST, DELETE, PUT, PATCH
res.setHeader("Access-Control-Allow-Headers",
"Content-Type, Content-Length, Accept-Ranges, Link, Transfer-Encoding");
}
Actually I am getting timeout errors on the HEAD request:
2017-06-11T22:32:29.689481+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=HEAD path="/pub/L2FwcC9taXNjL2VwdWJzL2NoaWxkcmVucy1saXRlcmF0dXJlLmVwdWI=/manifest.json" host=readium2.herokuapp.com request_id=6b631ae5-2d79-45df-aec9-89f578d5a07e fwd="86.130.138.178" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
This definitely seems related to cached HEAD requests, as I am not able to reproduce the bug on Chrome (OSX) with disabled HTTP cache (when the web inspector window is open).
Hi Daniel, Indeed the problem is not happening when Chrome Dev Tools are open, but otherwise, it happens deterministically, i.e., out of 2 subsequent refreshes one is going through, the other gets stuck, thanks, Michael
Noticed strange behavior when using R1 reader with Node JS R2 streamer. It looks like the subsequent hit of the same URL results in WebPub manifest being served from the cache is not correct.
Here is the environment:
R1 reader cd ~/ep/readium/readium-js-viewer npm run http
R2 streamer cd ~/r2-streamer-js yarn run server-debug .
open up R1 reader pointing to R2 Web Manifest http://localhost:8080/dev/index_RequireJS_no-optimize_LITE.html?epub=http://localhost:3000/pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json
First hit results in the book being open OK. Subsequent hit or refresh results in load indicator displayed indefinitely.
Here are the logs from R2 streamer:
First hit ::1 - - [09/Jun/2017:17:57:20 +0000] "HEAD /pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json HTTP/1.1" - - "http://localhost:8080/dev/index_RequireJS_no-optimize_LITE.html?epub=http://localhost:3000/pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" r2:server:pub /Users/michaels/r2-streamer-js/TalesFrpmShekspire.epub +23s r2:server:assets Asset not in zip! manifest.json/META-INF/container.xml +1ms ::1 - - [09/Jun/2017:17:57:20 +0000] "GET /pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json/META-INF/container.xml HTTP/1.1" 500 115 "http://localhost:8080/dev/index_RequireJS_no-optimize_LITE.html?epub=http://localhost:3000/pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" r2:server:pub /Users/michaels/r2-streamer-js/TalesFrpmShekspire.epub +1s ::1 - - [09/Jun/2017:17:57:22 +0000] "HEAD /pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json HTTP/1.1" 200 24453 "http://localhost:8080/dev/index_RequireJS_no-optimize_LITE.html?epub=http://localhost:3000/pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" r2:server:pub /Users/michaels/r2-streamer-js/TalesFrpmShekspire.epub +17ms ::1 - - [09/Jun/2017:17:57:22 +0000] "GET /pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json HTTP/1.1" 200 24453 "http://localhost:8080/dev/index_RequireJS_no-optimize_LITE.html?epub=http://localhost:3000/pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
Second hit or page refresh r2:server:pub /Users/michaels/r2-streamer-js/TalesFrpmShekspire.epub +40s r2:server:manifestjson manifest.json cache +5ms
Third hit ::1 - - [09/Jun/2017:17:58:30 +0000] "HEAD /pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json HTTP/1.1" - - "http://localhost:8080/dev/index_RequireJS_no-optimize_LITE.html?epub=http://localhost:3000/pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" r2:server:pub /Users/michaels/r2-streamer-js/TalesFrpmShekspire.epub +28s r2:server:assets Asset not in zip! manifest.json/META-INF/container.xml +1ms ::1 - - [09/Jun/2017:17:58:30 +0000] "GET /pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json/META-INF/container.xml HTTP/1.1" 500 115 "http://localhost:8080/dev/index_RequireJS_no-optimize_LITE.html?epub=http://localhost:3000/pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" r2:server:pub /Users/michaels/r2-streamer-js/TalesFrpmShekspire.epub +2s ::1 - - [09/Jun/2017:17:58:32 +0000] "HEAD /pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json HTTP/1.1" 200 24453 "http://localhost:8080/dev/index_RequireJS_no-optimize_LITE.html?epub=http://localhost:3000/pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" r2:server:pub /Users/michaels/r2-streamer-js/TalesFrpmShekspire.epub +16ms ::1 - - [09/Jun/2017:17:58:32 +0000] "GET /pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json HTTP/1.1" 200 24453 "http://localhost:8080/dev/index_RequireJS_no-optimize_LITE.html?epub=http://localhost:3000/pub/L1VzZXJzL21pY2hhZWxzL3IyLXN0cmVhbWVyLWpzL1RhbGVzRnJwbVNoZWtzcGlyZS5lcHVi/manifest.json" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
And so on - one hit is a success, subsequent from "cache" failure.