-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Viewer unable to display PDF files retrieved from different domains #6446
Comments
This is not an issue with PDF.js, it's an intentional security feature of browsers that websites cannot directly read files from other websites. Although it's possible to circumvent the issue using a proxy (e.g. as explained at #1000 (comment)), a better solution is to host PDF.js on the same website (e.g. cloudfront in your case). Then the URL would be something like: See https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr and https://github.com/mozilla/pdf.js/wiki/Setup-PDF.js-in-a-website. |
Thanks for pointing out the CORS issue. The cloud front endpoint was not configured for CORS (now configured), but the S3 origin behind it was. However, if you inspect the network requests while loading the above link, it shows 200 OK for the PDF resource which means the file was pulled correctly. I have tried HTTP and HTTPS with no luck (200 OK though in both cases). Any clue how this can be debugged? |
@hammady HTTP 200 OK means that the server found the resource. After that, what matters is that the If it still does not work, please include a log / screenshot of the network traffic. |
@Rob--W it is working now, I guess there was a big latency in applying CORS rules in AWS. Thanks! |
I am unable to display a PDF retrieved via SSL. Look at the demo with an SSL link:
http://mozilla.github.io/pdf.js/web/viewer.html?file=https://d2fqdaa97sxcjl.cloudfront.net/fulltext/c6f10e90-5646-4161-a72b-fa78bf76c5a0/I901_payment_confirmation_07262015.PDF
Is this a limitation of PDF.js? The certificates are OK and I believe this is something not related to PDF.js, if the browser can get it, then PDF.js should.
The text was updated successfully, but these errors were encountered: