Skip to content

curl⚓︎


curl without modifying the hosts file⚓︎

You can provide curl 7.21.3+ custom addresses for any host and port pair, forcing curl requests use a specified address and prevent the otherwise normally resolved address to be used. For each host:port pair you want to override you specify --resolve <host:port:address>, where the ‘*’ wildcard can be used as a host to resolve all DNS to the specified IP.

# perform a curl to google.com:443 and resolve to 1.1.1.1 (CloudFlare)
curl --resolve google.com:443:1.1.1.1 -k https://google.com

# perform a curl to any DNS and redirect to 1.1.1.1 (CloudFlare)
curl --resolve *:443:1.1.1.1 -k https://google.com