Using the cf CLI with an HTTP Proxy Server

Page last updated: December 11, 2015

If you have an HTTP proxy server on your network between a host running the cf CLI and your Cloud Foundry API endpoint, you must set HTTP_PROXY with the hostname or IP address of the proxy server.

The HTTP_PROXY environment variable holds the hostname or IP address of your proxy server.

HTTP_Proxy is a standard environment variable. Like any environment variable, the specific steps you use to set it depends on your operating system.

Format of HTTP_PROXY

HTTP_PROXY is set with hostname or IP address of the proxy server in URL format: http_proxy=http://proxy.example.com

If the proxy server requires a user name and password, include the credentials: http_proxy=http://username:[email protected]

If the proxy server uses a port other than 80, include the port number: http_proxy=http://username:[email protected]:8080

Setting HTTP_PROXY in Mac OS or Linux

Set the HTTP_PROXY environment variable using the command specific to your shell. For example, in bash, use the export command.

Example:

$ export HTTP_PROXY=http://my.proxyserver.com:8080

To make this change persistent, add the command to the appropriate profile file for the shell. For example, in bash, add a line like the following to your .bash_profile or .bashrc file:

  http_proxy=http://username:password@hostname:port;
  export $HTTP_PROXY

Setting HTTP_PROXY in Windows

  1. Open the Start menu. Right-click Computer and select Properties.

  2. In the left pane of the System window, click Advanced system settings.

  3. In the System Properties window, select the Advanced tab, then click Environment Variables.

  4. In the Environment Variables window, under User variables, click New.

  5. In the Variable name field, input HTTP_PROXY. In the Variable value field, input your proxy server information.

  6. Click OK.