Closed wkungu closed 3 years ago
@wkungu The issue here is that the server you are trying to access the pdf from, has a CORS policy that doesn't allow your localhost connection to download it's files. If you are just testing sample files, it would be easier to download the pdf and load it locally. Or have you're own server hosting the files, with your own CORS policy. Google Firebase has a level of free storage/hosting you could use I believe. Here is a CORS free sample pdf https://file-examples-com.github.io/uploads/2017/10/file-sample_150kB.pdf
I host my files using aws and set my cors policy as below
[ { "AllowedHeaders": [ "" ], "AllowedMethods": [ "GET", "HEAD" ], "AllowedOrigins": [ "" ], "ExposeHeaders": [], "MaxAgeSeconds": 3000 } ]
and i'm still facing this issue
I host my files using aws and set my cors policy as below
[ { "AllowedHeaders": [ "" ], "AllowedMethods": [ "GET", "HEAD" ], "AllowedOrigins": [ "" ], "ExposeHeaders": [], "MaxAgeSeconds": 3000 } ]
and i'm still facing this issue
Hi, Sorry this would be an aws / server issue
This worked for me on AWS.
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"HEAD"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]
Hi,
I'm getting
Access to fetch at 'https://remote_server/sample.pdf' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
while loading a remote file.How do I resolve this on react-doc-viewer?
Thanks