remove unused cors headers (#296)

no need for CORS middleware since we're using the same origin for the frontend.
This commit is contained in:
Victor Vrantchan 2016-10-11 17:10:20 -04:00 committed by GitHub
parent 86d2319170
commit 337822fde3

View file

@ -147,7 +147,7 @@ the way that the kolide server works.
httpLogger := kitlog.NewContext(logger).With("component", "http")
apiHandler := service.MakeHandler(ctx, svc, config.Auth.JwtKey, httpLogger)
http.Handle("/api/", accessControl(apiHandler))
http.Handle("/api/", apiHandler)
http.Handle("/version", version.Handler())
http.Handle("/metrics", prometheus.Handler())
http.Handle("/assets/", service.ServeStaticAssets("/assets/"))
@ -199,18 +199,3 @@ func (devMailService) SendEmail(e kolide.Email) error {
return err
}
// cors headers
func accessControl(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Origin, Content-Type")
if r.Method == "OPTIONS" {
return
}
h.ServeHTTP(w, r)
})
}