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
gefragt vor einem Jahr330 Aufrufe
1 Antwort
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
beantwortet vor einem Jahr
  • Thank you for the suggestion. I'll try to disable cache for OPTIONS response on CloudFront.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen