From d1a0c9326b2b764d8543fff5c58af1bf69442bc6 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Mon, 3 Jul 2023 23:25:40 +0530 Subject: [PATCH] Allow CORS - Set CORS headers to API requests --- server/public.go | 1 + 1 file changed, 1 insertion(+) diff --git a/server/public.go b/server/public.go index 0c870c08..db7313ce 100644 --- a/server/public.go +++ b/server/public.go @@ -307,6 +307,7 @@ func (s *PublicServer) jsonHandler(handler func(r *http.Request, apiVersion int) data = jsonError{"Internal server error", http.StatusInternalServerError} } } + w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Content-Type", "application/json; charset=utf-8") if e, isError := data.(jsonError); isError { w.WriteHeader(e.HTTPStatus)