Skip to content

Add lookup option to override dns lookups - #1574

Open
oBusk wants to merge 3 commits into
http-party:masterfrom
oBusk:dns-lookup
Open

oBusk wants to merge 3 commits into
http-party:masterfrom
oBusk:dns-lookup

Conversation

@oBusk

@oBusk oBusk commented Feb 24, 2022

Copy link
Copy Markdown

The cause of this is that when proxying api requests to a hostname, node will perform a dns query for every single request, which adds unnecessary overhead. While I was investigating I found nodejs/node#5893 and understood that there is no built in dns caching in node and that it seemingly bypasses OS dns cache. Adding a dns cache into http-proxy would clearly not be optimal, but by exposing the lookup option for request() we can customize the dns lookup that http-proxy performs and add our own cache, or inject https://www.npmjs.com/package/dns-lookup-cache or something similiar. (fixes #653)

This configuration would also allow to customize the DNS lookup (fixes #1315)

One problem with this is that the request() lookup option is only available in node v12 and later, so using the option when running node 8/10 would not have any effect. shouldn't implode either, but does nothing.

Add `lookup` option to allow overriding default dns resolving. This can be used to add caching or other customization.
@pi0 pi0 mentioned this pull request Mar 25, 2026
21 of 58 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom DNS server for target specification? DNS cache for proxying to remote server?

1 participant