CROS ORIGIN Error in React App that uses S3

I've been working on a project that client should upload a file into a Cloud Storage with AWS. My app was written with ReactJS and I decided to upload the file directly from client side to Cloud Storage. I've built the app and deployed it to server. (Here is the link raymon-tech.ir) But It returns

Access to XMLHttpRequest at 'https://kamal-archive.s3.ir-thr-at1.arvanstorage.com/aaa.js?uploads' from origin 'https://raymon-tech.ir' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

error. If I disable CORS of my browser, it works fine.

Submitted December 28th 2020 by Admin


If you need to upload files directly from your front-end app to S3 bucket, please make sure you add those to the bucket's CORS policy:

[ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET", "POST", "PUT", "HEAD" ], "AllowedOrigins": [ "*" ], "ExposeHeaders": [ "ETag", "Accept-Ranges", "Content-Encoding", "Content-Length ", "Content-Range" ], "MaxAgeSeconds": 3000 }

Admin | 9 months ago

Relevant Questions