mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-12 13:17:08 +08:00
Add warning when CORS feature is disabled. (#17)
Add PATCH and DELETE methods to CORS because we do expose some of those in our endpoints. (cherry picked from commit 9445d93)
This commit is contained in:
2
main.go
2
main.go
@@ -222,11 +222,13 @@ func main() {
|
||||
c := cors.New(cors.Options{
|
||||
AllowedOrigins: []string{*flCorsOrigin},
|
||||
AllowCredentials: true,
|
||||
AllowedMethods: []string{"GET", "POST", "PATCH", "DELETE"},
|
||||
})
|
||||
|
||||
corsHandler := c.Handler(mux)
|
||||
http.Handle("/", corsHandler)
|
||||
} else {
|
||||
logger.Log("warn", "CORS header is disabled")
|
||||
http.Handle("/", mux)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user