Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In S3 Bucket CORS Configrations not allowing xml and asking for json instead

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>

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 ?

like image 689
shank_fab_worker Avatar asked Nov 15 '20 07:11

shank_fab_worker


1 Answers

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

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

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "POST",
            "GET",
            "PUT"
        ],
        "AllowedOrigins": [
            "*"
        ]
    }
]
like image 91
sonlexqt Avatar answered Oct 30 '22 02:10

sonlexqt