diff --git a/cmd/freegeoip/main.go b/cmd/freegeoip/main.go index 3ab546e..5655e91 100644 --- a/cmd/freegeoip/main.go +++ b/cmd/freegeoip/main.go @@ -132,7 +132,7 @@ func openDB(dsn string, updateIntvl, maxRetryIntvl time.Duration) (db *freegeoip func CORS(f http.Handler, allow ...string) 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-Method", + w.Header().Set("Access-Control-Allow-Methods", strings.Join(allow, ", ")+", OPTIONS") if r.Method == "OPTIONS" { w.WriteHeader(200)