All Products
Search
Document Center

Alibaba Cloud SDK:Configure a proxy

Last Updated:Jun 16, 2026

Configure an HTTP proxy, an HTTPS proxy, or a no-proxy list in the Classic SDK by using environment variables or SDK client methods.

The following environment variables configure an HTTP proxy, an HTTPS proxy, and a no-proxy list:

  • HTTP_PROXY or http_proxy

  • HTTPS_PROXY

  • NO_PROXY

You can also configure a proxy when you initialize an SDK client. The client-level proxy takes precedence over the environment variables.

//Configure an HTTP proxy.
client.SetHttpProxy("http://localhost:8080");
//Query the HTTP proxy.
client.GetHttpProxy();

//Configure an HTTPS proxy.
client.SetHttpsProxy("https://localhost:8080");
client.SetHttpsProxy("http://username:password@localhost:8080");
//Query the HTTPS proxy.
client.GetHttpsProxy();

// Configure the addresses that do not require proxies.
client.SetNoProxy("example.com");
// Query the addresses that do not require proxies.
client.GetNoProxy();