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

"Failed to load PDF file." when using a URL/Parameter object. #139

Closed
wangzhidavid opened this issue Jan 24, 2018 · 4 comments
Closed

"Failed to load PDF file." when using a URL/Parameter object. #139

wangzhidavid opened this issue Jan 24, 2018 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@wangzhidavid
Copy link

2018-01-24 3 23 08

2018-01-24 3 19 26
Hello Wojciech Maj,

I have an problem trying to load PDFs from a URL/Parameter object.

I am using latest version react-pdf2.5.2, react-6.2.0, with the latest version of create-react-app.
I asked PHP to solve the problem of Same-origin policy by adding "Access-Control-Allow-Origin: '*'", but failed. There is no way to solve the problem.
Console output: Failed to load http://139.224.220.33:8868/Upload/video/20180112/1515721300451425.pdf: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Using onLoadError/onSourceError callbacks, i get the message 'onSourceSuccess : undefined, onLoadError: UnknownErrorException {name: "UnknownErrorException", message: "Failed to fetch", details: "UnknownErrorException: Failed to fetch"}'.

Thank you very much!

@wojtekmaj
Copy link
Owner

wojtekmaj commented Jan 24, 2018

Hello,
that topic has already been discussed in #36.

I'm afraid I can't be more clear than console output you got - Access-Control-Allow-Origin header is still missing so the request is still blocked.

Let me know if I can help you with anything else!

@wojtekmaj wojtekmaj self-assigned this Jan 24, 2018
@wojtekmaj wojtekmaj added the question Further information is requested label Jan 24, 2018
@wangzhidavid
Copy link
Author

Hi,
Thanks awesome. Thanks for the quick response!
I had read the discussed of #36 before i asked.The PHP can solve cross-domain problems by setting "Access Control-Allow-Origin: '*' or building a simple proxy to pass the file through the server, but here it is invalid. Could you give some advice to the PHP?
Thank you in advance!

@wojtekmaj
Copy link
Owner

I'm no expert in PHP, sorry. You'd need to ask somewhere else. All I know is that your server does not set this HTTP header, and that's why you see this error.

@wangzhidavid
Copy link
Author

Thanks for your time.
It's a pleasure to have your help.

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

No branches or pull requests

2 participants