feat: add block common exploits middleware

This commit is contained in:
2024-11-06 09:17:21 +01:00
parent a23111f1ad
commit 69e29dee2a
5 changed files with 120 additions and 6 deletions

View File

@@ -40,7 +40,11 @@ func (gatewayServer GatewayServer) Initialize() *mux.Router {
// Health check
r.HandleFunc("/health/live", heath.HealthReadyHandler).Methods("GET")
r.HandleFunc("/readyz", heath.HealthReadyHandler).Methods("GET")
// Enable common exploits
if gateway.BlockCommonExploits {
logger.Info("Block common exploits enabled")
r.Use(middleware.BlockExploitsMiddleware)
}
if gateway.RateLimiter != 0 {
//rateLimiter := middleware.NewRateLimiter(gateway.RateLimiter, time.Minute)
limiter := middleware.NewRateLimiterWindow(gateway.RateLimiter, time.Minute, gateway.Cors.Origins) // requests per minute