yuken 3 лет назад
Родитель
Сommit
cabc43144c
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      packages/app/src/server/middlewares/api-rate-limiter.ts

+ 3 - 1
packages/app/src/server/middlewares/api-rate-limiter.ts

@@ -34,7 +34,7 @@ const apiRateLimitConfig = generateApiRateLimitConfig();
 const configWithoutRegExp = apiRateLimitConfig.withoutRegExp;
 const configWithoutRegExp = apiRateLimitConfig.withoutRegExp;
 const configWithRegExp = apiRateLimitConfig.withRegExp;
 const configWithRegExp = apiRateLimitConfig.withRegExp;
 const allRegExp = new RegExp(Object.keys(configWithRegExp).join('|'));
 const allRegExp = new RegExp(Object.keys(configWithRegExp).join('|'));
-const keysWithRegExp = Object.keys(configWithRegExp).map(key => new RegExp(key));
+const keysWithRegExp = Object.keys(configWithRegExp).map(key => new RegExp(`^${key}`));
 const valuesWithRegExp = Object.values(configWithRegExp);
 const valuesWithRegExp = Object.values(configWithRegExp);
 
 
 
 
@@ -111,7 +111,9 @@ module.exports = () => {
     else if (allRegExp.test(endpoint)) {
     else if (allRegExp.test(endpoint)) {
       keysWithRegExp.forEach((key, index) => {
       keysWithRegExp.forEach((key, index) => {
         if (key.test(endpoint)) {
         if (key.test(endpoint)) {
+          logger.info(`endpoint: ${endpoint}`);
           customizedConfig = valuesWithRegExp[index];
           customizedConfig = valuesWithRegExp[index];
+          logger.info(`customizedConfig max: ${customizedConfig.maxRequests}`);
         }
         }
       });
       });
     }
     }