2021-09-13 00:39:09 +02:00
|
|
|
package handler
|
2021-01-24 10:48:07 +01:00
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
2021-09-13 00:39:09 +02:00
|
|
|
func DevelopmentCORS(next http.Handler) http.Handler {
|
2021-01-24 10:48:07 +01:00
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
2022-01-03 00:29:34 +01:00
|
|
|
w.Header().Set("Access-Control-Allow-Credentials", "true")
|
2021-01-24 10:48:07 +01:00
|
|
|
w.Header().Set("Access-Control-Allow-Origin", "http://localhost:8081")
|
2022-01-03 00:29:34 +01:00
|
|
|
if r.Method == "OPTIONS" {
|
|
|
|
return
|
|
|
|
}
|
2021-01-24 10:48:07 +01:00
|
|
|
next.ServeHTTP(w, r)
|
|
|
|
})
|
|
|
|
}
|