diff --git a/packages/bitcore-node/src/routes/middleware.ts b/packages/bitcore-node/src/routes/middleware.ts index 9d3b51e3973..5f74c7e58e3 100644 --- a/packages/bitcore-node/src/routes/middleware.ts +++ b/packages/bitcore-node/src/routes/middleware.ts @@ -68,12 +68,7 @@ export function CacheMiddleware(serverSeconds = CacheTimes.Second, browserSecond } function isWhiteListed(whitelist: Array = [], ip: string) { - let whiteListed = whitelist.includes(ip); - if (whiteListed) { - return true; - } else { - return whitelist.some(listItem => new RegExp(listItem).test(ip)); - } + return whitelist.some(listItem => ip.startsWith(listItem)); } export function RateLimiter(method: string, perSecond: number, perMinute: number, perHour: number) {