curl: Modify DNS Resolution

You can intercept normal name resolution in curl with the --resolve parameter allowing you to do things like talk to a specific site of a DNS load-balanced setup or talk to a new deployment not yet made productive.

You can specify the resolve option multiple times so you can even catch redirects and move them to where you want as well.

It’s important to note that this intercept does only work on the ports you specify in the entries.

curl --resolve --resolve

You can even combine this with the -K or --config parameter to build multiple presets to call different sites of your service on demand.

$ cat service-site-a.curl.conf

$ cat service-site-b.curl.conf

# Force yourself to site A
$ curl -K service-site-a.curl.conf

# Force yourself to site B
$ curl -K service-site-b.curl.conf

See also