Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progressive loading not working while loading pdf from another domain. #7531

Closed
kishanj918 opened this issue Aug 8, 2016 · 7 comments
Closed
Labels

Comments

@kishanj918
Copy link

kishanj918 commented Aug 8, 2016

When i load pdf within my domain, progressive loading is working. But when i load pdf from another domain i am getting Refused to get unsafe header "Accept-Ranges" error.
screen shot 2016-08-08 at 10 23 50 am

@Snuffleupagus
Copy link
Collaborator

This sounds like a CORS issue, please see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr. Closing as answered.

@kishanj918
Copy link
Author

@Snuffleupagus i have added cors config in my subdomain(media.docstub.com),still progressive loading is not working. My configs are as follow. and link to webpage is https://www.docstub.com/doc/212/lic-model-paper-ii. Can you help? thanks!

location / {
                try_files $uri $uri/ =404;
                add_header 'Access-Control-Allow-Origin' 'https://www.docstub.com';
                add_header 'Access-Control-Allow-Methods' 'GET';
                add_header 'Accept-Ranges' 'bytes';
                add_header 'Access-Control-Allow-Credentials' 'true';
                add_header 'Access-Control-Allow-Headers' 'Range';
                add_header 'Access-Control-Expose-Headers' 'content-range, content-length, accept-ranges';

        }

@pravid
Copy link

pravid commented Jan 18, 2019

Is there any solution yet?
I'm loading PDF from different domain. It is loading the PDF fine but not in chunks. It loads full PDF at one go.

@8ggmaker
Copy link

I have the same problem? any solutions?

@8ggmaker
Copy link

It loads full pdf instead of loading chunk by chunk when do cors request

@8ggmaker
Copy link

@pravid see #3150 , I solved this by add ExposedHeaders

@pravid
Copy link

pravid commented Jun 17, 2019

@zsybupt Thanks for informing. I tried adding expose header to my file but it is not working. I'm using rackspace cloud. Below are the headers I have set,

Content-Type: application/pdf
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Accept-Ranges, Content-Encoding, Content-Length, Content-Range
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Origin: *

What do I'm missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants