I am working on a project where i have to display ebooks on my Laravel web app. I am using futurepress/epub.js to display epub file, epub.js displays files stored in local storage but when i store the files in s3 and use s3 urls it throws exception.
1. Uncaught ReferenceError: href is not defined is thrown when i use signed s3 url
Example: Uncaught ReferenceError: href is not defined is thrown in this line var Book = ePub("https://venkitest1.s3.us-east-2.amazonaws.com/contents/1/1/1/b6221779e85b87c620decc8028aaf8188c000b26.epub?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI6LL2FHRGEK5PCKA%2F20171208%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20171208T112812Z&X-Amz-SignedHeaders=host&X-Amz-Expires=60&X-Amz-Signature=9a6ae022833c4a33495e164a6d5a9134b0444f821ea29d11c49b47b66f1727c8");
2. Failed to load https://venkitest1.s3.us-east-2.amazonaws.com/contents/1/1/1/b6221779e85b87c620decc8028aaf8188c000b26.epub: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access. is thrown when i use s3 public urls
Example: var Book = ePub("https://venkitest1.s3.us-east-2.amazonaws.com/contents/1/1/1/b6221779e85b87c620decc8028aaf8188c000b26.epub");
This works - var Book = ePub("http://localhost:8000/storage/contents/1/1/1/32bfe62a1a8fab105588af74f468f333a4396b53.epub");
Any Help is appreciated.
Thank You.