Skip to content
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

CORS ? #24

Closed
linonetwo opened this issue Aug 1, 2017 · 1 comment
Closed

CORS ? #24

linonetwo opened this issue Aug 1, 2017 · 1 comment

Comments

@linonetwo
Copy link

linonetwo commented Aug 1, 2017

It leaves this on the screen:

Unhandled Rejection (UnexpectedResponseException): 
Unexpected server response (0) while retrieving PDF "http://www.neeq.com.cn/disclosure/2014/1231/64673196.pdf".

and this on the console:

Warning: Setting up fake worker.

XMLHttpRequest cannot load http://www.neeq.com.cn/disclosure/2014/1231/64673196.pdf. 
No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:3000' is therefore not allowed access.


while network request of this PDF yields 206 Partial Content.

This PDF is not on my server, it's other people's server, I can't change CORS setting of it. How can I get this PDF file without CORS problem?

code:

            <PDF
              className="reportpdf"
              file={this.state.source.replace(/^http:/, "https:")}
              page={1}
            />
@mikecousins
Copy link
Owner

We just rely on the pdf.js library internally, so there's not much that we can do about this bug. There looks to be some documentation on their repo about how to get it going:

mozilla/pdf.js#6916

https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr

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

No branches or pull requests

2 participants