Skip to content Skip to sidebar Skip to footer

Cors 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

Solution 1:

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
    }
]

Post a Comment for "Cors Origin Error In React App That Uses S3"