Question

CORS spaces public

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!

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Accepted Answer

@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!

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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);
    }
  });
}

This comment has been deleted