Dima jangveladze
Dima jangveladze

Reputation: 33

S3 CORS error when I try insert image into ngx-image-cropper

I try to insert the S3 signed download URL into ngx-image-cropper; this is a snippet from my code:

<image-cropper [imageURL]="imageForCrop"/>

but I get a CORS error. I know what browsers cache these errors/images, and I should add some params value in the URL. But I can't add params value in the signed URL; it works when you have a private URL. I also tried to fetch this image using the S3 download URL, but it also got a CORS error.

This is my bucket CORS:

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

Upvotes: 0

Views: 47

Answers (1)

Shashank
Shashank

Reputation: 56

try this

[
{
    "AllowedHeaders": ["*"],
    "AllowedMethods": ["GET", "HEAD"],
    "AllowedOrigins": ["*"],
    "ExposeHeaders": ["Content-Type", "Content-Length", "ETag"],
    "MaxAgeSeconds": 3000
}

]

or use a proxy server if still its not working i.e fetch to node server then use in front-end

Upvotes: 0

Related Questions