From f885a671197c99356a043f4a1b6ddc2020fa9c57 Mon Sep 17 00:00:00 2001 From: slashexx Date: Thu, 5 Dec 2024 18:06:27 +0530 Subject: [PATCH] fix rerouting Signed-off-by: slashexx --- backend/api-gateway/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/api-gateway/main.go b/backend/api-gateway/main.go index 6f2bc1b..2320a79 100644 --- a/backend/api-gateway/main.go +++ b/backend/api-gateway/main.go @@ -12,16 +12,16 @@ type CodeRequest struct { Language string `json:"language"` Code string `json:"code"` } - func enableCors(w http.ResponseWriter) { w.Header().Set("Access-Control-Allow-Origin", "https://codebrewery.vercel.app") w.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS") - w.Header().Set("Access-Control-Allow-Headers", "Content-Type") + w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization") + w.Header().Set("Access-Control-Allow-Credentials", "true") // If required } func executeCode(w http.ResponseWriter, r *http.Request) { - fmt.Printf("Received %s request for %s\n", r.Method, r.URL.Path) enableCors(w) + fmt.Printf("Received %s request for %s\n", r.Method, r.URL.Path) if r.Method == http.MethodOptions { w.WriteHeader(http.StatusOK)