2

I have an amazon s3 bucket called cs-ia.
This is my CORS configuration:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "PUT",
            "POST",
            "GET",
            "HEAD"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [
            "Access-Control-Allow-Origin"
        ]
    }
]

This is the bucket policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicListGet",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:List*",
                "s3:Get*"
            ],
            "Resource": [
                "arn:aws:s3:::cs-ia",
                "arn:aws:s3:::cs-ia/*"
            ]
        }
    ]
}

I'm trying to upload images from a webpage. I'm calling createPresignedPost on the backend and then sending a POST request to https://s3.amazonaws.com/cs-ia with the required payload.

I get the following CORS error:

Access to XMLHttpRequest at 'https://s3.amazonaws.com/cs-ia' from origin 'http://192.168.43.52:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Why does this not work despite my configuration?

0

You must log in to answer this question.

Browse other questions tagged .