1CURLOPT_NOPROXY(3) curl_easy_setopt options CURLOPT_NOPROXY(3)
2
3
4
6 CURLOPT_NOPROXY - disable proxy use for specific hosts
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOPROXY, char *noproxy);
12
14 Pass a pointer to a null-terminated string. The string consists of a
15 comma separated list of host names that do not require a proxy to get
16 reached, even if one is specified. The only wildcard available is a
17 single * character, which matches all hosts, and effectively disables
18 the proxy. Each name in this list is matched as either a domain which
19 contains the hostname, or the hostname itself. For example, example.com
20 would match example.com, example.com:80, and www.example.com, but not
21 www.notanexample.com or example.com.othertld.
22
23 If the name in the noproxy list has a leading period, it is a domain
24 match against the provided host name. This way ".example.com" will
25 switch off proxy use for both "www.example.com" as well as for "foo.ex‐
26 ample.com".
27
28 Setting the noproxy string to "" (an empty string) will explicitly en‐
29 able the proxy for all host names, even if there is an environment
30 variable set for it.
31
32 Enter IPv6 numerical addresses in the list of host names without en‐
33 closing brackets:
34
35 "example.com,::1,localhost"
36
37 IPv6 numerical addresses are compared as strings, so they will only
38 match if the representations are the same: "::1" is the same as "::0:1"
39 but they do not match.
40
41 The application does not have to keep the string around after setting
42 this option.
43
45 If there's an environment variable called no_proxy (or NO_PROXY), it
46 will be used if the CURLOPT_NOPROXY(3) option is not set. It works ex‐
47 actly the same way.
48
50 NULL
51
53 Most
54
56 CURL *curl = curl_easy_init();
57 if(curl) {
58 /* accept various URLs */
59 curl_easy_setopt(curl, CURLOPT_URL, input);
60 /* use this proxy */
61 curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
62 /* ... but make sure this host name is not proxied */
63 curl_easy_setopt(curl, CURLOPT_NOPROXY, "www.example.com");
64 curl_easy_perform(curl);
65 }
66
68 Added in 7.19.4
69
71 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
72 not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
73
75 CURLOPT_PROXY(3), CURLOPT_PROXYAUTH(3),
76
77
78
79libcurl 7.85.0 May 17, 2022 CURLOPT_NOPROXY(3)