-
-
Notifications
You must be signed in to change notification settings - Fork 848
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
Getting cors error even though the fetch is returning 200 #370
Comments
Any insight to this? |
I gave the possibility that there is a CORS issue when trying to fetch from s3, but it fails on publicly available pdf too, such as |
Hey, You need to download PDF from exact same domain. Or create a proxy. Or configure the server PDF is on to send appropriate headers to support CORS requests. HTTP200 is returned by the server because it should do so. It's the browser that rejects this request because it failed to meet Cross-Origin Policy. |
how to solve this problem ?, i have same error |
Did anyone find a solution for this problem? |
same issue. |
React-PDF can't work around browsers blocking requests according to Cross-Origin Resource Policy. As previously stated:
|
Before you start - checklist
What are you trying to achieve? Please describe.
Load a PDF via external URL.
Both the external url and my localhost have the same origin path, that is configured in etc file. But I get CORS error.
Here is the interesting part, in the networks tab I can see that the pdf is fetched with 200, but right after that the cors error is thrown in the console.
I'm sure of my localhost setup because I can finely import images to react components via same assets url.
Describe solutions you've tried
Tried passing it with url object {url: https//....} , but no luck.
Tried switching to regular import vs webpack, but no luck.
import { Document, Page } from 'react-pdf/dist/entry.webpack';
vs
import { Document, Page } from 'react-pdf';
Additional information
See attached screenshot.
Environment
The text was updated successfully, but these errors were encountered: