curl Providing custom IP address for a name


The most effective way to resolve curl to a different server is to use the --resolve option. This option will insert the address into curl's DNS cache, so it will effectively make curl believe that's the address it got when it resolved the name. Like so:

curl --resolve

In the above example, firstly we specify the domain (, then we ask it to connect on port 80 to the IP Depending on the protocol used and the server's configuration, the port can vary. For HTTP the port is 80 and for HTTPS, the port is 443.

It is important to note here that the --resolve option will send SNI for the name in the URL. This means that when connecting to the server via HTTPS, curl will verify the server's response to make sure it servers for the name in the URL. In other words, it will ensure there is an SSL on the server installed for the domain.