【问题标题】:S3 Bucket CORS configuration not accepted不接受 S3 存储桶 CORS 配置
【发布时间】:2021-12-28 00:01:45
【问题描述】:

互联网的人们,我需要你的帮助。我正在尝试将此代码放入我的 S3 存储桶 CORS 中,但出现此错误:Expected params.CORSConfiguration.CORSRules to be an Array

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

【问题讨论】:

标签: amazon-web-services amazon-s3 cors


【解决方案1】:

您的 JSON 无效。如果您使用在线(或其他)验证器对此进行测试,您会在 AllowedMethods 中看到一个错误,特别是该数组中的最终值有一个尾随逗号(有效的 JavaScript,但无效的 JSON)。

将政策更改为:

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

【讨论】:

  • 谢谢!我的错,我想我只需要学习阅读错误消息。消息很清楚,他们已经告诉我这是一个无效的 JSON
猜你喜欢
  • 2017-09-21
  • 1970-01-01
  • 2015-01-08
  • 2020-07-16
  • 2017-01-30
  • 2016-03-02
  • 2021-03-31
  • 2017-09-05
  • 2016-08-06
相关资源
最近更新 更多