1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Dockerd: enable CORS when only --api-cors-header is used

Even though the flag `--api-enable-cors` is deprecated in favor of
`--api-cors-header`. Using only `--api-cors-header` does not enable
CORS.

Make changes to 'cmd/dockerd/daemon.go' to enable cors if either of
the above flags is set.

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
This commit is contained in:
Karthik Nayak 2017-03-28 18:01:21 +05:30
parent a048e131be
commit f0f673f4d5
No known key found for this signature in database
GPG key ID: 901F07912321ACB8

View file

@ -511,7 +511,7 @@ func (cli *DaemonCli) initMiddlewares(s *apiserver.Server, cfg *apiserver.Config
vm := middleware.NewVersionMiddleware(v, api.DefaultVersion, api.MinVersion)
s.UseMiddleware(vm)
if cfg.EnableCors {
if cfg.EnableCors || cfg.CorsHeaders != "" {
c := middleware.NewCORSMiddleware(cfg.CorsHeaders)
s.UseMiddleware(c)
}