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>
| ... | ... |
@@ -511,7 +511,7 @@ func (cli *DaemonCli) initMiddlewares(s *apiserver.Server, cfg *apiserver.Config |
| 511 | 511 |
vm := middleware.NewVersionMiddleware(v, api.DefaultVersion, api.MinVersion) |
| 512 | 512 |
s.UseMiddleware(vm) |
| 513 | 513 |
|
| 514 |
- if cfg.EnableCors {
|
|
| 514 |
+ if cfg.EnableCors || cfg.CorsHeaders != "" {
|
|
| 515 | 515 |
c := middleware.NewCORSMiddleware(cfg.CorsHeaders) |
| 516 | 516 |
s.UseMiddleware(c) |
| 517 | 517 |
} |