Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Domains defined in the /etc/hosts file do not resolve #60

Closed
Kethatril opened this issue Nov 23, 2021 · 1 comment
Closed

Domains defined in the /etc/hosts file do not resolve #60

Kethatril opened this issue Nov 23, 2021 · 1 comment

Comments

@Kethatril
Copy link

I am using Craft Nitro (https://getnitro.sh/) for local CMS development and connecting to the api using @vercel/fetch. Nitro provides URL's that look like https://testcms.nitro and updates the /ect/hosts file with that domain. However these domains do not resolve using @vercel/vetch

It looks like this is happening because https://github.com/vercel/dns-cached-resolve is using dns.resolve4/dns.resolve6 both of which ignore the hosts file. Looking into the node DNS documentation it looks like dns.lookup uses the system DNS lookup which does look at /etc/hosts however there are performance implications when using it (https://nodejs.org/api/dns.html#implementation-considerations)

https://github.com/vercel/dns-cached-resolve special cases localhost, but It might be a good idea to allow a fallback to dns.lookup when dns.resolve fails to allow other domains defined in /etc/hosts to work. This could be an option set when setting up @vercel/fetch and it would allow enabling / disabling this behaviour depending on environment.

@Ethan-Arrowood
Copy link
Contributor

Thank you for the report. We are archiving this project; you can read more details here: #83

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants