generated from VLADIMIR/template
add place name
This commit is contained in:
@@ -77,7 +77,7 @@ func main() {
|
||||
|
||||
gwServer := &http.Server{
|
||||
Addr: ":8090",
|
||||
Handler: gwmux,
|
||||
Handler: cors(gwmux),
|
||||
}
|
||||
|
||||
// Serve gRPC-Gateway server
|
||||
@@ -104,3 +104,15 @@ func main() {
|
||||
log.Println("Serving admin web on http://0.0.0.0:8110")
|
||||
log.Fatalln(http.ListenAndServe(":8110", muxAdmin))
|
||||
}
|
||||
|
||||
func cors(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, PATCH, DELETE")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, Authorization, ResponseType, X-Id, X-Password")
|
||||
if r.Method == "OPTIONS" {
|
||||
return
|
||||
}
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user