fix: routes health check

This commit is contained in:
Jonas Kaninda
2024-11-15 08:19:22 +01:00
parent fca775dd5f
commit cb31faf65f
4 changed files with 34 additions and 4 deletions

View File

@@ -236,10 +236,15 @@ func (gatewayServer GatewayServer) Initialize() *mux.Router {
logger.Info("Block common exploits enabled")
router.Use(middleware.BlockExploitsMiddleware)
}
id := string(rune(rIndex))
if len(route.Name) != 0 {
// Use route name as ID
id = util.Slug(route.Name)
}
// Apply route rate limit
if route.RateLimit > 0 {
rateLimit := middleware.RateLimit{
Id: string(rune(rIndex)), // Use route index as ID
Id: id, // Use route index as ID
Requests: route.RateLimit,
Window: time.Minute, // requests per minute
Origins: route.Cors.Origins,