How to make reqwest redirect request using /etc/host configuration

Hello everyone,

I need solve how to request an API through a VPN in a local environment, this API needs to be consumed with a https domain but it has to be configured to redirect to specific IP address in the /etc/hosts configuration like this:

10.5.1.1        subdomain.domain.com

So making a ping to subdomain.domain.com will result in:

PING https://subdomain.domain.com (10.5.1.1): 56 data bytes

When I use the reqwest client it always occur a timeout and I'm afraid the domain to IP conversion never happen, if I do a local CURL it works, but not with my http client.

Any ideas what should I need to do? I'm lost.

Thanks in advance.

Luis Fer

AFAIK reqwest will use the name resolution code in libstd (the ToSocketAddrs impl on &str) which uses getaddrinfo on Unix.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.