Report this

What is the reason for this report?

CORS spaces public

Posted on December 2, 2017

Greetings, I am new to spaces and pretty much excited what DO is accomplishing . Setup and upload was easy using node.js aws-sdk, I have few large JSON files which I want to serve API-Like for the client Unfortunately I don’t know how to setup CORS for such application Please advice Thanks!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

@rudixlab we just added support for CORS configuration via the UI this week. You can find it on the ‘Settings’ tab of any Space. Hope this helps!

This comment has been deleted

seems like I fixed it using AWS sdk with node.js

 const thisConfig = {
    AllowedMethods: ['GET', 'POST', 'PUT', 'HEAD'],
    AllowedOrigins: ['*'],
    ExposeHeaders: [],
    MaxAgeSeconds: 3000,
  };

  const corsRules = new Array(thisConfig);
  const corsParams = {
    Bucket: 'bucket-name',
    CORSConfiguration: { CORSRules: corsRules },
  };
  // set the new CORS configuration on the selected bucket
  s3.putBucketCors(corsParams, (err, data) => {
    if (err) {
      console.log('Error', err);
    } else {
      console.log('Success', data);
    }
  });
}

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.