Override DNS for a host

Send the request to a chosen IP for a host:port pair. Handy for testing a server behind a CDN or load balancer.

curl --resolve example.com:443:1.2.3.4 https://example.com

tool
curl21 commands
tags
curlnetworkdebug

More curl commands

  • curl --retry 5 --retry-delay 2 --retry-all-errors https://api.example.com/healthz

    Retry up to 5 times, 2 seconds apart, on any error.

  • curl -d 'user=alice&pass=secret' -X POST https://auth.example.com/login

    Send form data in URL-encoded format.

  • curl --cert client.crt --key client.key --cacert ca.crt https://secure.example.com

    Make an mTLS request with a client certificate and your own CA.

  • cat urls.txt | xargs -P 5 -I{} curl -sSL -o /dev/null -w '%{url_effective} %{http_code}\n' {}

    Request URLs from a file, 5 at a time, and print the final URL and status code for each.

  • curl -i -N -H 'Upgrade: websocket' -H 'Connection: Upgrade' -H 'Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==' -H 'Sec-WebSocket-Version: 13' http://localhost:8080/ws

    Check that the WebSocket upgrade returns status 101.

all 21 curl commands