-1

I'm trying to fetch, from the client side and server side, documents that i've stored in an aws S3 bucket using the multer-s3 lib, because heroku doesn't want me to save my files in the public folder. When i fetch the link, from the client side i have the classic Cros Origin error and i don't know how to resolve it, and in the server side, the document "doesn't exist", even though the link is correct because i tested it manually.

I have something like that in my client side :

const myfile = await fetch("https://bucket.s3.region.amazonaws.com/"+filename).then(res => res.arrayBuffer());

the error :

Reason: CORS header 'Access-Control-Allow-Origin' missing

I understand that i have to configure a CORS header but i don't understand where i'm supposed to put it.

Is it possible by using aws in the client side ? Because i tried and it didn't seem to work really well.

Thanks in advance for your help :)

0 Answers0