在S3 Bucket CORS配置中,不允许xml,而是要求json [英] In S3 Bucket CORS Configrations not allowing xml and asking for json instead

查看:105
本文介绍了在S3 Bucket CORS配置中,不允许xml,而是要求json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在S3存储桶CORS配置中,不允许使用"XML"并要求"Json"代替

In S3 Bucket CORS Configrations not allowing "XML" and asking for "Json" instead

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedMethod>PUT</AllowedMethod>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

以前可以工作,但现在却给我这个错误必须使用有效的JSON编写CORS配置".在"Amazon S3存储桶"中进行了一些更改.由AMAZON提供,请给我这个json以添加到CORS吗?

Was Working earlier but now it is giving me this error "The CORS configuration must be written in valid JSON." Some Changes are made in "Amazon S3 Bucket" by AMAZON , Please give me json of this to add in CORS ?

推荐答案

在新的S3控制台中,CORS配置必须为JSON.在此处了解更多信息.

In the new S3 console, the CORS configuration must be JSON. Read more here.

在您的情况下,JSON CORS配置可编写如下:

In your case, the JSON CORS configuration can be written as follow:

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

这篇关于在S3 Bucket CORS配置中,不允许xml,而是要求json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆