How to set ACL to public-read when adding a file to S3 or DigitalOcean

I have a function that adds a file to Digital Ocean Spaces.

Files are Private by default. I want the files to be public for reading.

I added "x-amz-acl": "public-read" in headers to get public files.

This solution does not work. The API does not accept and returns the SignatureDoesNotMatch error.

There is nothing in the documentation about this. I perform the action through axios as a pure REST API

const uploadInvitationImage = () => {
      .get(general.apiUrl + "api/aws/uploadUrl/" + name + ".png", {
        headers: headers,
      .then((response) => {
        if (response.status == 200) {
          const uploadUrl =;
            method: "PUT",
            url: uploadUrl,
            data: fileImage,
            headers: {
              "Content-Type": "image/png",
              "x-amz-acl": "public-read",
            .then((res) => {
            .catch((err) => {

>Solution :

The API you are calling at "api/aws/uploadUrl/" needs to add those to the URL it generates, before it signs the URL.

Leave a Reply