CORS spaces public

Posted December 2, 2017 7.3k views
Object Storage

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

1 comment
  • both methods have not worked for me, via the web UI I get errors so my CORS rules are added but disappear when I refresh the page. Via the API I get an error with the code ‘UnknownError’

    Any help would be much appreciated!

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
3 answers

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

  • Hello. This does not seem to work. There are still no Allow headers returned

    • @ilguzin can you email me your config (the XML you used, or screengrab of UI) plus debugging output from curl or the browser? jgannon at do dot co

      • It’s weird, but looks like now it works. There probably was a delay before the changes propagated (at least more then one hour). Although i’m not sure which of the approaches worked for me: the AWS SDK based that is @rudixlab suggested or DigitalOcean Settings UI, i tried both. At any rate thanks for quick response.

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