diff --git a/.gitignore b/.gitignore index 39918c2..5a7139c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ pg_data *.log *.env *.env.dev -build \ No newline at end of file +build +*.exe +*.exe~ \ No newline at end of file diff --git a/cmd/api/server.go b/cmd/api/server.go index 7a6e98b..10ef21b 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -73,9 +73,11 @@ func (s *FiberServer) SetupServer( "http://localhost:3001", "https://history-admin.kain.id.vn", "https://history-user.kain.id.vn", + "https://www.history-admin.kain.id.vn", + "https://www.history-user.kain.id.vn", }, - AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"}, - AllowHeaders: []string{"Accept", "Authorization", "Content-Type", "Origin"}, + AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH", "HEAD"}, + AllowHeaders: []string{"Accept", "Authorization", "Content-Type", "Origin", "Range", "Cache-Control", "Pragma", "If-Modified-Since", "If-None-Match"}, AllowCredentials: true, })) diff --git a/internal/controllers/authController.go b/internal/controllers/authController.go index 51fa07b..6e9ed1f 100644 --- a/internal/controllers/authController.go +++ b/internal/controllers/authController.go @@ -448,10 +448,12 @@ func (h *AuthController) GoogleCallback(c fiber.Ctx) error { }) allowed := map[string]bool{ - "http://localhost:3000": true, - "http://localhost:3001": true, - "https://history-admin.kain.id.vn": true, - "https://history-user.kain.id.vn": true, + "http://localhost:3000": true, + "http://localhost:3001": true, + "https://history-admin.kain.id.vn": true, + "https://history-user.kain.id.vn": true, + "https://www.history-admin.kain.id.vn": true, + "https://www.history-user.kain.id.vn": true, } feUrl := config.GetConfigWithDefault("FRONTEND_URL", "http://localhost:3000") redirectURL := data.RedirectURL diff --git a/internal/controllers/goongController.go b/internal/controllers/goongController.go index 47e1cd8..a22b805 100644 --- a/internal/controllers/goongController.go +++ b/internal/controllers/goongController.go @@ -83,6 +83,8 @@ func (ctrl *goongController) Proxy(c fiber.Ctx) error { c.Set(k, v) } + c.Set("Vary", "Origin") + if c.Method() == "GET" { if statusCode == fiber.StatusOK || statusCode == fiber.StatusNotModified { c.Set("Cache-Control", "public, max-age=86400")