satorumurmur / bibi

Bibi | EPUB Reader on your website.
https://bibi.epub.link
MIT License
833 stars 123 forks source link

Unnecessary request for META-INFO/container.xml #112

Open davidqqq opened 3 years ago

davidqqq commented 3 years ago

First up, this library is amazing and works really well on mobile device.

Unfortunately, I am stuck on a request to META-INFO/container.xml for a day. It only happens in cross origin requests even after configuring trustyorigins array accordingly. I have tried to load index.html?book=https://xxxxxxx/book.epub from google firestore (non-same domain url) which triggered request for non-existent META-INFO/container.xml. Strangely, I can load same book.epub locally without a problem so I think this request is not necessary?

To test my suspicion on request headers, I set up a local Nodejs server to examine the headers between requests and cant really find anything useful. What is surprising is that when NodeJs fetch the book.epub from google firestore url and forward to client, the book loads well. The app is on port 4000 and the node server is on 4001 which mimic the same cors setup. I have deployed it to a remote server and configured web server. https://my-bibi-book/book.epub is https and the domain is different from bibi app. This same book still loads well.

This somewhat confirms my suspicion about the request headers. Upon further debugging, I found, before the META-INFO/container.xml request is made, the on-the-fly.bibi-zip-loader.worker.js is actually throwing Content-Range not found. That file is compiled so I dont really know what is happening there but my guess is that when this file throws error the script will make a request to META-INFO/container.xml. @satorumurmur can you provide me more information regarding the condition when META-INFO/container.xml is required?

I can live by deploying my backend on a server however I would prefer using serverless solutions (lambda, vercel) which none is working.