Leff
Leff

Reputation: 1276

AWS S3 bucket cors configuration error - The XML you provided was not well-formed or did not validate against our published schema

I am trying to set up the cors configuration for my bucket in S3, but for the following XML:

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

I get an error:

The XML you provided was not well-formed or did not validate against our published schema

What is wrong with the XML I posted?

Upvotes: 0

Views: 1054

Answers (1)

JD D
JD D

Reputation: 8087

This looks to be the classic case of something like Microsoft Word changing the quote characters when you copy/paste them. Notice how the quotes in the <CORSConfiguration line look different than the line above?

Here is a reformatted version that should work.

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

Also, if you are getting XML validation errors in the future, you can use tools like https://codebeautify.org/xmlvalidator to help.

Upvotes: 1

Related Questions