How to Set Up curl Proxy: HTTP, SOCKS5, Auth, and IP Checks

Start with the answer: Direct answer
curl can use an assigned HTTP, HTTPS, or SOCKS5 endpoint through --proxy (-x). Add credentials with --proxy-user (-U), choose socks5h when hostname resolution must occur through the proxy endpoint, and verify the connection with status, timing, verbose output, and a permitted IP echo service. Use placeholders in examples and keep real credentials out of command history and repositories.
Treat every command as a temporary test case. Save a redacted command, expected endpoint protocol, target host, and rollback command together so another operator can repeat the check without receiving the secret itself.
Fields to confirm before running curl
| Check | What to record |
|---|---|
| Required fields | Protocol, host, port, and any assigned username and password |
| HTTP/HTTPS syntax | Use --proxy or -x with the assigned endpoint URL |
| Authentication | Use --proxy-user or -U; avoid committing credentials to scripts |
| SOCKS DNS | socks5 resolves locally; socks5h asks the proxy endpoint to resolve the hostname |
| Verification | Check status, timing, verbose output, and a permitted IP echo endpoint |
Record the protocol, HOST, PORT, USERNAME, PASSWORD, target URL, timeout, and expected verification result. Do not guess an endpoint protocol or claim SOCKS5 support when the assigned service does not provide it.
A proxy URL has a different role from the target URL. The proxy URL selects the connection route; the target URL is the permitted public page being requested. Mixing those roles can make a TLS or DNS error look like an authentication failure.


