Authenticate with a client certificate

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

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

tool
curl21 commands
tags
curlsecurity

More curl commands

  • 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.

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

    Download a file at no more than 1 MB/s.

  • curl -s -X POST https://api.example.com/v1/resource -H 'Content-Type: application/json' -H 'Authorization: Bearer <token>' -d '{"key":"value"}' | jq .

    Send a JSON POST request with a Bearer token and pretty-print the reply.

  • curl -sLv https://example.com 2>&1 | grep -E '^[<>*]'

    Follow redirects and show only request and response headers, without the body.

all 21 curl commands