From 2aa327a86ff0b95ef9a68c7cda6b3c6e7e3ca957 Mon Sep 17 00:00:00 2001 From: Marcos Lilljedahl Date: Sun, 15 Apr 2018 18:06:41 -0300 Subject: [PATCH] Add localhost as a CORS handler for local SDK testing --- handlers/bootstrap.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/handlers/bootstrap.go b/handlers/bootstrap.go index 97ab7b8..4df2b48 100644 --- a/handlers/bootstrap.go +++ b/handlers/bootstrap.go @@ -58,7 +58,9 @@ func Register(extend HandlerExtender) { 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 { - 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 false