diff --git a/pkg/config.go b/pkg/config.go index 19e460d..5fa7dba 100644 --- a/pkg/config.go +++ b/pkg/config.go @@ -247,30 +247,23 @@ func initConfig(configFile string) { Routes: []Route{ { Name: "HealthCheck", - Path: "/healthy", - Destination: "http://localhost:8080", - Rewrite: "/health", + Path: "/public", + Destination: "http://localhost:80", + Rewrite: "/healthz", HealthCheck: "", - Cors: Cors{ - Headers: map[string]string{ - "Access-Control-Allow-Headers": "Origin, Authorization, Accept, Content-Type, Access-Control-Allow-Headers, X-Client-Id, X-Session-Id", - "Access-Control-Allow-Credentials": "true", - "Access-Control-Max-Age": "1728000", - }, - }, }, { Name: "Basic auth", - Path: "/basic", - Destination: "http://localhost:8080", - Rewrite: "/health", + Path: "/protected", + Destination: "https://example.com", + Rewrite: "/", HealthCheck: "", Blocklist: []string{}, Cors: Cors{}, Middlewares: []RouteMiddleware{ { - Path: "/basic/auth", - Rules: []string{"basic-auth", "google-jwt"}, + Path: "/user", + Rules: []string{"basic-auth"}, }, }, }, @@ -285,10 +278,13 @@ func initConfig(configFile string) { Password: "goma", }, }, { - Name: "google-jwt", + Name: "jwt", Type: "jwt", Rule: JWTRuler{ - URL: "https://www.googleapis.com/auth/userinfo.email", + URL: "https://www.googleapis.com/auth/userinfo.email", + RequiredHeaders: []string{ + "Authorization", + }, Headers: map[string]string{}, Params: map[string]string{}, }, diff --git a/pkg/handler.go b/pkg/handler.go index 000a90c..5cd5e3c 100644 --- a/pkg/handler.go +++ b/pkg/handler.go @@ -107,6 +107,7 @@ func (heathRoute HealthCheckRoute) HealthCheckHandler(w http.ResponseWriter, r * } func (heathRoute HealthCheckRoute) HealthReadyHandler(w http.ResponseWriter, r *http.Request) { response := HealthCheckRouteResponse{ + Name: "Goma Gateway", Status: "healthy", Error: "", } diff --git a/pkg/route.go b/pkg/route.go index bc7cca1..97a79c9 100644 --- a/pkg/route.go +++ b/pkg/route.go @@ -123,7 +123,7 @@ func (gatewayServer GatewayServer) Initialize() *mux.Router { router := r.PathPrefix(route.Path).Subrouter() router.Use(CORSHandler(route.Cors)) - router.PathPrefix("/").Handler(proxyRoute.ProxyHandler()) + router.PathPrefix("").Handler(proxyRoute.ProxyHandler()) } else { logger.Error("Error, path is empty in route %s", route.Name) logger.Info("Route path ignored: %s", route.Path)