From 523af1b0cb9e996d6bfebc63c4a62e18d93b8571 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Tue, 31 Jan 2023 23:34:04 -0300 Subject: [PATCH] add cors allow methods and headers --- backend/middlewares/cors.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/middlewares/cors.go b/backend/middlewares/cors.go index 0fddd4e..3c85eaf 100644 --- a/backend/middlewares/cors.go +++ b/backend/middlewares/cors.go @@ -11,7 +11,8 @@ func Cors(handler http.Handler) http.Handler { switch origin { case "http://localhost:5173", "http://localhost", "https://alai.cromer.cl": writer.Header().Set("Access-Control-Allow-Origin", origin) - writer.Header().Set("Access-Control-Allow-Headers", "Content-Type") + writer.Header().Set("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT,DELETE,PATCH") + writer.Header().Set("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization") } handler.ServeHTTP(writer, request)