Skip to content

Commit

Permalink
fix: bypass cacheable-lookup when resolving localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
gauthier-th committed Jun 12, 2024
1 parent 0342127 commit 906ca61
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,12 @@ app
const originalLookup = cacheable.lookup;

// if hostname is localhost use dns.lookup instead of cacheable-lookup
cacheable.lookup = (
hostname: string,
options: any,
callback?: any
): void => {
cacheable.lookup = (...args: any) => {
const [hostname] = args;
if (hostname === 'localhost') {
return lookup(hostname, options);
lookup(...(args as Parameters<typeof lookup>));
} else {
return originalLookup(hostname, options, callback);
originalLookup(...(args as Parameters<typeof originalLookup>));
}
};

Expand Down

0 comments on commit 906ca61

Please sign in to comment.