Move CORS handler wrapping into cmd/apiserver and switch config flag to a list of allowed origins

This commit is contained in:
Jessica Forrester
2014-09-03 14:33:52 -04:00
parent 8723eece49
commit 8b4ca9c2a7
11 changed files with 102 additions and 50 deletions

View File

@@ -55,11 +55,7 @@ func Handle(storage map[string]RESTStorage, codec runtime.Codec, prefix string)
mux := http.NewServeMux()
group.InstallREST(mux, prefix)
InstallSupport(mux)
handler := RecoverPanics(mux)
if enableCORS {
handler = CORS(handler, []string{".*"}, nil, nil, "true")
}
return &defaultAPIServer{handler, group}
return &defaultAPIServer{RecoverPanics(mux), group}
}
// APIGroup is a http.Handler that exposes multiple RESTStorage objects