Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lookup option to override dns lookups #1574

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

oBusk
Copy link

@oBusk oBusk commented Feb 24, 2022

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.
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