webodf / ViewerJS

ViewerJS: Document Reader in JavaScript

Home Page:http://viewerjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS S3 and CORS

cristianocca opened this issue · comments

Getting the following error when trying to load a remote PDF file from S3.

Access to XMLHttpRequest at '<URL>' from origin 'http://localhost:8123' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. pdf.worker.js:33922 Refused to get unsafe header "Accept-Ranges"`

Any work-around?

commented

I also stuck on the same issues for hours.

does your server on localhost set the 'Access-Control-Allow-Origin' header? It is needed according to the error message.

Access-Control-Allow-Headers: Accept-Ranges

might do the trick.