Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Set HTTP proxy to use.

Component Version macOS Windows Linux Server iOS SDK
CURL 2.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionProxy"; curl; Value { ; Encoding } )   More


Parameter Description Example Flags
curl The CURL session handle. $curl
Value The proxy string ""
Encoding The text encoding for text parameter.
Default is UTF-8.
Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ.
"utf8" Optional


Returns "OK" on success.


Set HTTP proxy to use.
The parameter should be a text string holding the host name or dotted IP address. To specify port number in this string, append :[port] to the end of the host name. The proxy string may be prefixed with [protocol]:// since any such prefix will be ignored. The proxy's port number may optionally be specified with the separate option. If not specified, libcurl will default to using port 1080 for proxies. see also CURL.SetOptionProxyPort.

When you tell the library to use an HTTP proxy, libcurl will transparently convert operations to HTTP even if you specify an FTP URL etc. This may have an impact on what other features of the library you can use, such as CURL.SetOptionQuote and similar FTP specifics that don't work unless you tunnel through the HTTP proxy. Such tunneling is activated with CURL.SetOptionHTTPProxyTunnel.

libcurl respects the environment variables http_proxy, ftp_proxy, all_proxy etc, if any of those are set. The CURL.SetOptionProxy option does however override any possibly set environment variables.

Setting the proxy string to "" (an empty string) will explicitly disable the use of a proxy, even if there is an environment variable set for it.

Since 7.14.1, the proxy host string given in environment variables can be specified the exact same way as the proxy can be set with CURL.SetOptionProxy, include protocol prefix (http://) and embedded user + password.

Since 7.21.7, the proxy string may be specified with a protocol:// prefix to specify alternative proxy protocols. Use socks4://, socks4a://, socks5:// or socks5h:// (the last one to enable socks5 and asking the proxy to do the resolving, also known as CURLPROXY_SOCKS5_HOSTNAME type) to request the specific SOCKS version to be used. No protocol specified, http:// and all others will be treated as HTTP proxies.

Setting the property and getting back OK does just mean that the plugin passed the value. It does not confirm that the proxy is working or used.

See also PROXY option in CURL manual.


Set a proxy:

MBS( "CURL.SetOptionProxy"; $curl; "“)

See also

Release notes

Blog Entries

Created 18th August 2014, last changed 5th December 2016

CURL.SetOptionProtocolsString - CURL.SetOptionProxyAuth