Why can I use "http://localhost:PORT" with CORS in Spaces?

Posted January 24, 2018 19.5k views
Object Storage

Safari doesn’t respect my wildcard rule in CORS but Firefox and Chrome do. None of the suggestions in this StackOverflow post helped either:

I feel like this could be remedied if Spaces was configured to allow a URL without a TLD.

1 comment
  • I was trying to enter CORS for localhost on a Space, and it appears the UI is still not handling (you have to upload an XML file still). Does this plan on ever getting fixed?

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

Thanks for flagging this issue for us. It looks like the input validation in our control panel is a bit too strict here. As a work-around until this experience is improved, you can create CORs configurations for Spaces using the API for origins without a TLD. For example, using s3cmd you can run:

  • s3cmd setcors cors.xml s3://example-space

Where the contents of the cors.xml file contains your CORs configurations in XML format. For example:



  • any news on this? I don’t want to use another tool just for this.

  • More than a year later and I had to get a CDN up for my wife’s blog so I went through this process. Turns out the “example-space” in s3://example-space has to be the name you chose for your Space.

    This roundabout way of adding localhost support worked but it’d be much appreciated if the UI could do it.

So the year has gone by and it still isn’t possible to set as a cors via the control panel

CORS options are now available thru DigitalOcean Dashboard.
If you are facing this problem:

  1. Go to
  2. Select your Space
  3. Go to Settings tab
  4. On “CORS Configurations”, click on the “+” (Plus) button

Create a new configuration with this values:

  • Origin: *
  • Allowed Methods: GET
  • Allowed Headers: Click “Add header” an them: *
  • Save options

Should work.

There are no pre-built s3cmd binaries for Windows.

So the depth of things we need to do to set CORS for Spaces for local development:

  • Cant set CORS because of rules too strict, must use s3cmd:
  • Must get s3cmd. Cannot get s3cmd because no windows binaries.
  • Must build s3cmd from source. Cannot build s3cmd from source because it requires Python 2.x.
  • Must download Python 2.x in system. Must vet python for development. If your stack does not include Python. Must learn python.


With me Localhost works only after set a certified on php.ini.

curl.cainfo = “pathtocert\cacert.pem”

I hope help you guys!

For a step by step of how to complete this using s3cmd please see