It’s possible to force DNS resolving in cURL using the --resolve
switch.
The
--resolve
switch allows you to tell curl which address to request when it would resolve a given hostname.
The format of the argument is domain:port:ip
# HTTPS Example
curl -I -L https://domain.example.org/ \
--resolve domain.example.org:443:192.168.0.1
# HTTP Example
curl -I -L http://domain.example.org/ \
--resolve domain.example.org:80:192.168.0.1
Handy for testing a new server or load balancer you’ve prepared, or when wanting to bypass Cloudflare Proxying without touching Cloudflare’s settings.
~
Thank me with a coffee.
I don\'t do this for profit but a small one-time donation would surely put a smile on my face. Thanks!
To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.