How to disable cors (cross origin requests restriction) on the docker remote API

2,561 views
Skip to first unread message

Erik Anderson

unread,
Oct 27, 2014, 11:15:05 AM10/27/14
to coreo...@googlegroups.com
According to the documentation found here https://coreos.com/docs/distributed-configuration/etcd-configuration/ you should be able to set the API to allow for cross origin requests restriction.  However on the CoreOS base there is no such directory as /etc/etcd/etcd.conf.  Does this need to be created and etcd started with it as an option?  I'm a bit lost here.

Brandon Philips

unread,
Oct 27, 2014, 11:18:57 AM10/27/14
to coreos-dev
Hello Erik-
This is configuration for etcd but your subject says docker. Are you
asking about docker or etcd?!

By default CORS is disabled for etcd so no further action is required
to disable CORS on etcd.

Thanks,

Brandon

Erik Anderson

unread,
Oct 27, 2014, 1:35:41 PM10/27/14
to coreo...@googlegroups.com
Hi Brandon,

it was a long night.  What I am doing is sending Docker Remote API rest calls from a container


index.html:28
XMLHttpRequest cannot load http://192.168.1.6:2375/?_=1414391147155. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access. index.html:1

From looking at this, it looks like the CoreOS Docker Remote API implementation has -cors turned on.

Erik

Stephan Z.

unread,
Oct 27, 2014, 1:37:46 PM10/27/14
to coreo...@googlegroups.com
You need to pass `  --api-enable-cors=true` to `docker -d`.

Rob Szumski

unread,
Oct 27, 2014, 2:06:18 PM10/27/14
to coreo...@googlegroups.com
The process for doing this is very similar to the docs on enabling the debug flag, just swap out the flag:

Erik Anderson

unread,
Oct 30, 2014, 6:40:35 PM10/30/14
to coreo...@googlegroups.com
Excellent, this is exactly what I needed
Reply all
Reply to author
Forward
0 new messages