mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
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:
parent
86d2319170
commit
337822fde3
1 changed files with 1 additions and 16 deletions
17
cli/serve.go
17
cli/serve.go
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue