I am accessing CloudFront from two different domains. I configured S3 to allow cross-origin from both domains. A page from mydomain1 would get the data properly, then a page from mydomain2 would send out the request correctly:
> origin: https://mydomain2
and CloudFront responded with:
< content-type: application/json
< content-length: 65
< date: Fri, 04 Dec 2020 22:45:50 GMT
< access-control-allow-origin: https://mydomain1
< access-control-allow-methods: GET, PUT
< access-control-allow-credentials: true
< accept-ranges: bytes
< server: AmazonS3
< x-cache: Hit from cloudfront
Of course, the browser blocked this request, as the allowed-origin didn’t match
I initially thought that I had the Origin Request Policy wrong, but no, I was using the Managed-CORS-S3Origin, which had the right name and I checked it and it said it was passing along the Origin header to S3 origin — the problem was not made any easier by the fact that “origin” in the Content Distribution business means something very different than what it means in HTTP business.
But clearly, the value of the Access-Control-Allow-Origin response header is being cached for some reason.
