Use a proxy with curl
Demonstrates HTTP/HTTPS CONNECT and SOCKS5 TCP requests using fixed username and password gateways and environment credentials.
Maintained by the ZZHTTP engineering teamUpdated September 20, 2026
The curl example is suitable for minimal authentication and server health checks. True values are injected only through controlled environment variables or keys.
HTTP/HTTPS
curl --connect-timeout 10 --max-time 30 \
--proxy 'http://us.zzhttp.com:7878' \
--proxy-user "$PROXY_USERNAME:$PROXY_PASSWORD" \
'https://ipinfo.io/json'
SOCKS5 TCP
curl --connect-timeout 10 --max-time 30 \
--proxy 'socks5h://us.zzhttp.com:7878' \
--proxy-user "$PROXY_USERNAME:$PROXY_PASSWORD" \
'https://ipinfo.io/json'
Prepare
- Get the full proxy username and sub-username and password from the console and inject them separately
PROXY_USERNAMEandPROXY_PASSWORD; Indicative valueab******9Z,p8******K2Cannot be used for authentication. - Avoid displaying passwords in shell history and CI output.
Implementation
- HTTP proxies can access HTTP or HTTPS targets.
- SOCKS5 domain name requests
socks5h.
Verification steps
- Place the real configuration in a controlled environment variable or temporary credential store, without writing the full proxy URL to the script store.
- Run HTTP/HTTPS and HTTPS separately
socks5hFor example, retain connection timeouts and overall timeouts. - Check HTTP status codes and JSON
ip,country,regionExports and selected regions were compared with those without the use of agents. Geographical locations are from third-party databases and the results for cities may be biased.
Expected results
- The command returns successful within the 30-second total timeout, and the output IP in the response is different from the local public IP.
socks5hThe target domain name is resolved by the proxy side, avoiding passing the domain name to the local DNS first.
Failure border
- curl exits while parsing the command or proxy URL, indicating that the request has not yet reached the gateway;
407The certification phase is only indicated by the number of points. - Successful address detection does not guarantee accessibility to any target, target
403,429and business contents are subject to independent judgment.
Security
- The debug output requires the removal of Proxy-Authorization.
- Do not paste the entire command with the password into the worksheet.
Did this answer your question?
Feedback is used only to improve the public documentation and does not submit accounts or request information.