curl --connect-to api.example.com:443:127.0.0.1:3000 https://api.example.com

Category: Web App Development

curl --connect-to api.example.com:443:127.0.0.1:3000 https://api.example.com

Route a request to a local port instead of the DNS host

Connects to 127.0.0.1 port 3000 while keeping api.example.com in the URL and TLS certificate checks. This lets you test production-shaped requests against a local server without editing /etc/hosts. The mapping format is host:port:connect-host:connect-port.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.