angular aws-sdk - 对预检请求的响应未通过访问控制检查:资源上不存在 'Access-Control-Allow-Origin' header

angular aws-sdk - Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the resource

Angular代码:

import * as AWS from 'aws-sdk';

try {
      AWS.config.update({
          accessKeyId:config.access_id,
          secretAccessKey:config.access_key,
          region:config.region
        })
      
      const s3 = new AWS.S3();
      const files = s3.listObjectsV2({
        Bucket:config.bucket_name
      }).promise();
      console.log(files);
    }
    catch(e) {
      console.log(e);
    }

桶的CORS配置:

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

控制台中的错误消息:

Access to XMLHttpRequest at 'https://bucket.s3.region.amazonaws.com/?list-type=2' from origin 'https://xxxxxxxxxx.cloudfront.net' 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.

云端配置:

存储桶是私有的。阻止所有 public 访问已启用。没有静态网站托管。我正在尝试列出私人存储桶中的文件。

感谢任何帮助。

问题已解决。创建了新的私有存储桶并尝试添加相同的配置。发生错误是因为我正在使用设置了存储桶策略的存储桶所以它似乎限制了访问。