14 lines
354 B
Go
14 lines
354 B
Go
package main
|
|
|
|
import "net/http"
|
|
|
|
func CorsMiddleware(next http.Handler) http.Handler {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Add("Access-Control-Allow-Origin", "*")
|
|
w.Header().Add("Access-Control-Allow-Credentials", "*")
|
|
w.Header().Add("Access-Control-Allow-Headers", "*")
|
|
|
|
next.ServeHTTP(w, r)
|
|
})
|
|
}
|