Add localhost as a CORS handler for local SDK testing

This commit is contained in:
Marcos Lilljedahl
2018-04-15 18:06:41 -03:00
parent 645f07362e
commit 2aa327a86f

View File

@@ -58,7 +58,9 @@ func Register(extend HandlerExtender) {
corsRouter := mux.NewRouter() corsRouter := mux.NewRouter()
corsHandler := gh.CORS(gh.AllowCredentials(), gh.AllowedHeaders([]string{"x-requested-with", "content-type"}), gh.AllowedMethods([]string{"GET", "POST", "HEAD", "DELETE"}), gh.AllowedOriginValidator(func(origin string) bool { corsHandler := gh.CORS(gh.AllowCredentials(), gh.AllowedHeaders([]string{"x-requested-with", "content-type"}), gh.AllowedMethods([]string{"GET", "POST", "HEAD", "DELETE"}), gh.AllowedOriginValidator(func(origin string) bool {
if strings.HasSuffix(origin, "play-with-docker.com") || strings.HasSuffix(origin, "play-with-moby.com") { if strings.HasSuffix(origin, "localhost") ||
strings.HasSuffix(origin, "play-with-docker.com") ||
strings.HasSuffix(origin, "play-with-moby.com") {
return true return true
} }
return false return false