mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-24 17:04:42 +01:00
15 lines
369 B
Go
15 lines
369 B
Go
package handler
|
|
|
|
import "net/http"
|
|
|
|
func DevelopmentCORS(next http.Handler) http.Handler {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Access-Control-Allow-Credentials", "true")
|
|
w.Header().Set("Access-Control-Allow-Origin", "http://localhost:8081")
|
|
if r.Method == "OPTIONS" {
|
|
return
|
|
}
|
|
next.ServeHTTP(w, r)
|
|
})
|
|
}
|