How to do Cors configuration For AWS S3 Bucket to make it work on React website?

How to do Cors configuration For AWS S3 Bucket to make it work on React website?

How to do Cors configuration For AWS S3 Bucket to make it work on React website?

In short:-

Issue on frontend:- Access to fetch at ” api” from origin “websiteurl” 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.

Solution:-

Go to s3 console

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "HEAD"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]

Backstory:- Recently, I just joined a new startup. The guy wanted me to make this speech annotation app on a website with react, so that user can annotate the timestamp regions and give a label for that.

Features:-

Library used:-

Time taken :- 2-3 days to make the prototype

Here how the app looks like:-

speechAnnotation2.gif

Sun Feb 18 2024 00:00:00 GMT+0000 (Coordinated Universal Time)