CORS - Json The CORS configuration must be written in valid JSON. API response Expected params.CORSConfiguration.CORSRules to be an Array

0

Does anyone know why I am getting this error? Thanks a lot

已提問 2 個月前檢視次數 142 次
2 個答案
1

Hi,

Please use this link as a reference https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManageCorsUsing.html

[
    {
        "AllowedHeaders": [
            "Content-Type", 
            "Authorization"
        ],
        "AllowedMethods": [
            "PUT",
            "POST",
            "GET"
        ],
        "AllowedOrigins": [
            "http://www.example.com"
        ],
        "ExposeHeaders": [
           "x-custom-header"
        ],
        "MaxAgeSeconds": 3000
    }
]
profile picture
專家
已回答 2 個月前
0

try using this template:

{
  "CORSConfiguration": {
    "CORSRules": [
      {
        "AllowedOrigins": ["http://example.com"],
        "AllowedMethods": ["GET", "POST", "PUT"],
        "AllowedHeaders": ["Content-Type", "Authorization"],
        "MaxAgeSeconds": 3000,
        "ExposeHeaders": ["x-custom-header"]
      }
    ]
  }
}

If this has answered your question or was helpful, accepting the answer would be greatly appreciated. Thank you!

profile picture
專家
已回答 2 個月前
  • Thanks a lot for taking the time to respond. Still getting this error: The CORS configuration must be written in valid JSON. API response Expected params.CORSConfiguration.CORSRules to be an Array

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南