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
질문됨 일 년 전330회 조회
1개 답변
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
답변함 일 년 전
  • Thank you for the suggestion. I'll try to disable cache for OPTIONS response on CloudFront.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠