Retry on failure

Retry up to 5 times with 2s delay on any error

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

tool
curl21 commands
tags
curl

More curl commands

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

    Send URL-encoded form data

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

    mTLS request with client cert and custom CA

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

    Download 5 URLs in parallel and print status codes

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

    Verify WebSocket upgrade handshake responds with 101

  • curl --limit-rate 1M -O https://example.com/bigfile.iso

    Limit download bandwidth to 1 MB/s

all 21 curl commands