Cors error on fetching images with axios from S3 bucket

Viewed 14

I have a use case where I need to fetch s3 image with the use of axios but I am facing CORS issue in that. If I add the presigned URL directly in the image tag it logs the error in console but loads the image successfully. But in axios it does not fetch the blob and gives the CORS error. I have tested almost everything found on google in ExposeHeaders. If I use the CORS chrome extension error gets resolved.enter image description here My Aws policy and error screenshots are attached below

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

enter image description here

0 Answers
Related