AWS S3 bucket CORS configuration is reset every time when object is updated

0

I have set up CORS configuration for my S3 bucket and everything is working as expected. Here is my JSON configuration:

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

But if I upload new version of file with same name, then CORS error returns again. This happens every time and only cache invalidation on CloudFront helps in this case.

How I can set up my bucket so that the CORS configuration is not reset every time when bucket objects has been updated?

belyan
asked a year ago317 views
1 Answer
1

Hi , you should check this link and may be you need to create a separate cache policy to include "Origin" header and then attach this policy in the behaviour in cloudfront. check this link for more details..

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html#:~:text=If%20you%20have%20enabled%20cross%2Dorigin%20resource%20sharing%20(CORS)%20on%20an%20Amazon%20S3%20bucket%20or%20a

AWS
answered a year ago
  • Thank you for the suggestion. I'll try to disable cache for OPTIONS response on CloudFront.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions