I am attempting to use curl's
--resolve option to connect to the specified IP address when performing the HTTP request, but curl keeps reverting back to the IP address as retrieved by my local DNS cache/resolver.
curl -s -S -I -H "Host: example.com" --resolve example.com:80:18.104.22.168 --verbose http://example.com/
example.com is replaced by my domain name, and
22.214.171.124 replaced by the desired destination IP address)
* Added example.com:80:126.96.36.199 to DNS cache * Hostname was NOT found in DNS cache * Trying 188.8.131.52... * Connected to example.com (184.108.40.206) port 80 (#0) > HEAD / HTTP/1.1 > User-Agent: curl/7.35.0 > Accept: */* > Host: example.com
220.127.116.11 is replaced by the IP address cached in my local DNS resolver for my domain name)
So, it looks like curl attempts to add
18.104.22.168 to the DNS cache for
example.com, but fails somehow and reverts back to original IP address.
Any ideas on how to fix this problem or troubleshoot further to find out why its not working?