From bd0436bf98f5f30d882b88e328be17916fc4b7fa Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 30 Oct 2015 11:49:08 -0700 Subject: [PATCH] Change default options for cors to handle HEAD and allow all headers --- generic-handlers.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/generic-handlers.go b/generic-handlers.go index a596078de..822160c76 100644 --- a/generic-handlers.go +++ b/generic-handlers.go @@ -120,7 +120,12 @@ func (h timeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // CorsHandler handler for CORS (Cross Origin Resource Sharing) func CorsHandler(h http.Handler) http.Handler { - return cors.Default().Handler(h) + c := cors.New(cors.Options{ + AllowedOrigins: []string{"*"}, + AllowedMethods: []string{"GET", "HEAD", "POST"}, + AllowedHeaders: []string{"*"}, + }) + return c.Handler(h) } // IgnoreResourcesHandler -