From f17dac854216c7421138f80316e42ddc1815fb61 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Mon, 15 Aug 2022 09:41:44 +0200 Subject: [PATCH 1/2] Allow CORS request --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 9da4196..7bac796 100644 --- a/main.go +++ b/main.go @@ -196,6 +196,8 @@ func ServeJSONStudent(w http.ResponseWriter, r *http.Request) { log.Printf("Handling %s request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent()) w.Header().Set("Content-Type", "application/json") + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS") login := strings.TrimSuffix(strings.TrimPrefix(r.URL.Path, "/"), ".json") From 45aef0b63793ca5cd4d0bffe59d2ef0c36265201 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Mon, 15 Aug 2022 10:12:36 +0200 Subject: [PATCH 2/2] Disallow indexing --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index 7bac796..1e1d188 100644 --- a/main.go +++ b/main.go @@ -30,6 +30,7 @@ func Serve(w http.ResponseWriter, r *http.Request) { ` + title + ` +