Using the cf CLI with a Proxy Server
Page last updated:
This topic describes using the Cloud Foundry Command Line Interface (cf CLI) with a proxy server.
If you have an HTTP or SOCKS5 proxy server on your network between a host running the cf CLI and your API endpoint, you must set
https_proxy with the hostname or IP address of the proxy server. The
https_proxy environment variable holds the hostname or IP address of your proxy server.
https_proxy is a standard environment variable. Like any environment variable, the specific steps you use to set it depends on your operating system.
https_proxy is set with hostname or IP address of the proxy server in URL format, as in the example below:
If the proxy server requires a username and password, you must include the credentials, as in the example below:
If the proxy server uses a port other than 80, you must include the port number, as in the example below:
If the proxy server is a SOCKS5 proxy, you must specify the SOCKS5 protocol in the URL, as in the example below:
cf ssh command for cf CLI v7 does not work through a SOCKS5 proxy.
To set the
https_proxy environment variable in Mac OS or Linux:
Use the command specific to your shell. For example, in bash, use the
exportcommand, as in the example below:
To make this change persistent, add the command to the appropriate profile file for the shell. For example, in bash, add a line like example below to your
https_proxy=http://username:password@hostname:port export $https_proxy
To set the
https_proxy environment variable in Windows:
Open the Start menu.
Right-click Computer and select Properties.
In the left pane of the System window, click Advanced system settings.
In the System Properties window:
- Select Advanced.
- Click Environment Variables.
Under User variables, click New.
For Variable name, enter
For Variable value, enter your proxy server information.