Unable to upload images into spaces in angular

Posted January 20, 2020 1.9k views
DigitalOcean Spaces

When i try to upload images into spaces i am getting 403 forbidden issue and cors issue.

s3 = new AWS.S3({
    endpoint: endPoint,
    accessKeyId: accessKey,
    secretAccessKey: secretKey

 const params = {
        Bucket: 'test-upload',
        Body: file,
        ContentType: file[0].type,
        ACL: 'public-read',
        // CORSConfiguration: { CORSRules: this.corsRules }
        // headers: { 'Access-Control-Allow-Origin': '*' }
      this.s3.putObject(params, (err, data) => {
        if (err) {
          console.log('err', err);
        } else {
          console.log('Successfully uploaded data to DO speaces', data);
edited by bobbyiliev

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


I believe that you have to try to add your domain name the CORS Configurations under your DigitalOcean Control panel:

  • Go to your DigitalOcean Control Panel
  • Then go to Space
  • Select your Space
  • Click on Settings
  • Under the CORS Configurations add your domain name and select GET.

Hope that this helps!