From 171115d2af703f2239004d92b89066bbb2d249ab Mon Sep 17 00:00:00 2001 From: pg9182 <96569817+pg9182@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:03:22 -0400 Subject: pkg/api/api0: Add CORS headers to /client/servers --- pkg/api/api0/client.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg') diff --git a/pkg/api/api0/client.go b/pkg/api/api0/client.go index ea3ce9c..a01c170 100644 --- a/pkg/api/api0/client.go +++ b/pkg/api/api0/client.go @@ -572,6 +572,10 @@ func (h *Handler) handleClientServers(w http.ResponseWriter, r *http.Request) { w.Header().Set("Expires", "0") w.Header().Set("Pragma", "no-cache") + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, HEAD") + w.Header().Set("Access-Control-Max-Age", "86400") + if r.Method == http.MethodOptions { w.Header().Set("Allow", "OPTIONS, HEAD, GET") w.WriteHeader(http.StatusNoContent) -- cgit v1.2.3