From 36fe7b5e15a7f0c0e1cee320d9c92352a137bf23 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sat, 26 Oct 2024 15:37:22 +0800 Subject: [PATCH] fix(api): allow cors --- api/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/main.go b/api/main.go index e95d112..6311d20 100644 --- a/api/main.go +++ b/api/main.go @@ -128,6 +128,8 @@ func generateJSON(ip string) (body, error) { } func handleRequest(w http.ResponseWriter, r *http.Request) { + w.Header().Add("Access-Control-Allow-Origin", "*") + sourceIP := func() string { if q := r.URL.Query().Get("q"); q != "" { return q