Guides
How to send requests through a proxy in curl
A request through an HTTP proxy and through SOCKS5 with a login and password in curl, and a check of the issued address.
What you need
The proxy is issued in the format host:port:login:password. In the examples below, replace HOST, PORT, LOGIN and PASSWORD with your own values. The curl utility is available in macOS and Linux, and in Windows 10 and later it is also included as curl.exe.
PowerShell
In PowerShell, the word curl is an alias for a different command. Call curl.exe and put the values in single quotes.
Example
# --proxy sets the proxy, --proxy-user passes the login and password (no need to encode them)
# --max-time limits the time of the whole request so the command does not hang
curl --proxy 'http://HOST:PORT' \
--proxy-user 'LOGIN:PASSWORD' \
--max-time 30 \
https://api.ipify.orgThe proxy address starts with http:// even for HTTPS sites: curl itself opens a secure tunnel to the site with the CONNECT command. If the response prints the proxy's address and not your home one, everything works.
curl -v --proxy 'http://HOST:PORT' --proxy-user 'LOGIN:PASSWORD' https://api.ipify.orgIf SOCKS5
If your proxy has a separate SOCKS5 port, specify it and the socks5h:// scheme. The letter h at the end means the proxy resolves the site name, not your computer.
curl --proxy 'socks5h://HOST:SOCKS_PORT' \
--proxy-user 'LOGIN:PASSWORD' \
--max-time 30 \
https://api.ipify.orgCommon errors
- 407 Proxy Authentication Required: the login or password is wrong or was not sent. Run the command with the -v flag and compare the details with what was issued.
- Timeout or Connection timed out: check HOST and PORT and that you did not put the SOCKS5 port into HTTP mode (or the other way round).
- Special characters in the password: with --proxy-user nothing needs encoding, but in bash put the value in single quotes, otherwise the shell will eat $, ! and &. If you still write the login and password directly in the address (http://LOGIN:PASSWORD@HOST:PORT), they must be percent-encoded: @ as %40, : as %3A, / as %2F, # as %23.
- The https:// scheme in the proxy address: by default the proxy works over HTTP, so write http://HOST:PORT even for HTTPS sites. The https:// scheme means a secure connection to the proxy itself.
Sources
Checked against the official documentation: October 2026. Program interfaces change: if item names differ, follow the documentation.
All guides are collected on the Guides page.
Find a proxy in the chat