I am trying to fetch pdf from s3 links and display in the react app. I am using react-pdf for it. but when react-pdf makes api call to fetch the pdf I am getting this error
Access to fetch at '...' from origin '...' 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.
on React app I have also added this,
source={{ header: { 'Access-Control-Allow-Origin': '*', }, }}
Access-Control-Allow-Originheader needs set on the server (s3), not the client (react app). This is a good write up, be sure to notice the difference between request and response. For example, the 'preflight' is a common point of confusion. auth0.com/blog/… - Karl Galvez