Using the cf CLI with a Proxy Server | Cloud Foundry Docs
Format of _proxy
Use SOCKS5 with cf v3-ssh
Set _proxy in Mac OS or Linux
Set _proxy in Windows
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 _proxy with the hostname or IP address of the proxy server. The _proxy environment variable holds the hostname or IP address of your proxy server.
_proxy is a standard environment variable. Like any environment variable, the specific steps you use to set it depends on your operating system.
_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:
The cf v3-ssh command in cf CLI v6 supports SOCKS5 proxies.
To specify the SOCKS5 proxy server:
Set the all_proxy environment variable, as in the example below:
Note: The cf ssh command for cf CLI v7 does not work through a SOCKS5 proxy.
To set the _proxy environment variable in Mac OS or Linux:
Use the command specific to your shell. For example, in bash, use the export command, 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. bash_profile or file:
To set the _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:
Click Environment Variables.
Under User variables, click New.
For Variable name, enter _proxy.
For Variable value, enter your proxy server information.
Create a pull request or raise an issue on the source for this page in GitHub
Set http_proxy environment variable with domain user and …
I’ve read many posts about this topic but unfortunately haven’t been able to resolve my issue.
I’ve been trying to set _proxy and _proxy environment variables in windows using command prompt to be able to access my company’s web proxy.
I’m using Windows 8. 1 in which proxy settings are already set to
Port = 8080.
my system is inside domain, so:
my domain username is company
and my domain password is BA@123
It’s worth mentioning that when I ping, command prompt shows: Pinging [192. 168. 39. 21] and it gives request timeout.
Now, based on above information, my question is:
What might be the reason of request timeout when pinging proxy address?
Are proxy credentials the same as domain credentials?
what is the correct way of setting _proxy variable in command prompt?
I’ve tried many variations including:
But in all cases, running a command such as Curl -I gives the following error:
HTTP/1. 1 407 Proxy Authentication Required ( Forefront TMG requires
authorizatio n to fulfill the request. Access to the Web Proxy filter
is denied. )
Working with HTTP Proxies | Installation and Configuration
You are viewing documentation for a release that is no longer supported. The latest supported version of version 3 is [3. 11]. For the most recent version 4, see 
Configuring Hosts for Proxies
Configuring Hosts for Proxies Using Ansible
Proxying Docker Pull
Configuring S2I Builds for Proxies
Configuring Default Templates for Proxies
Setting Proxy Environment Variables in Pods
Git Repository Access
Production environments can deny direct access to the Internet and instead have
an HTTP or HTTPS proxy available. Configuring OpenShift Enterprise to use these
proxies can be as simple as setting standard environment variables in
configuration or JSON files.
This can be done during an
advanced installation or configured after installation.
The proxy configuration must be the same on each host in the cluster. Therefore,
when setting up the proxy or modifying it, you must update the files on each
OpenShift Enterprise host to the same values. Then, you must restart OpenShift Enterprise
services on each host in the cluster.
The NO_PROXY, HTTP_PROXY, and HTTPS_PROXY environment variables are found in
each host’s /etc/sysconfig/atomic-openshift-master file (for single
master configuration), /etc/sysconfig/atomic-openshift-master-api, or
/etc/sysconfig/atomic-openshift-master-controllers files (for multi-master
configuration) and /etc/sysconfig/atomic-openshift-node.
The NO_PROXY environment variable lists all of the OpenShift Enterprise
components and all IP addresses that are managed by OpenShift Enterprise.
NO_PROXY accepts a comma-separated list of hosts, IP addresses, or IP ranges
in CIDR format:
For master hosts
Node host name
Master IP or host name
For node hosts
For the Docker service
Registry service IP and host name
NO_PROXY also includes the SDN network and service IP addresses as found
in the file.
clusterNetworkCIDR: 10. 1. 0. 0/16
serviceNetworkCIDR: 172. 30. 0/16
OpenShift Enterprise does not accept * as a wildcard attached to a domain suffix. For
example, this works:
However, this does not:
The only wildcard NO_PROXY accepts is a single * character, which matches
all hosts, and effectively disables the proxy.
Each name in this list is matched as either a domain which contains the host
name as a suffix, or the host name itself.
For instance, would match,, and
Edit the proxy environment variables in the OpenShift Enterprise control files. Ensure all
of the files in the cluster are correct.
HTTPS_PROXY=USERNAME:PASSWORD@10. 1:8080/, 10. 0/16, 172. 0/16 (1)
Supports host names and CIDRs. Must include the SDN network and service IP ranges 10. 0/16 by default.
Restart the master or node host as appropriate:
# systemctl restart atomic-openshift-master
# systemctl restart atomic-openshift-node
For multi-master installations:
# systemctl restart atomic-openshift-master-controllers
# systemctl restart atomic-openshift-master-api
Example 1. Example Proxy Configuration with Ansible
# Global Proxy Configuration
# These options configure HTTP_PROXY, HTTPS_PROXY, and NOPROXY environment
# variables for docker and master services.
# Most environments do not require a proxy between OpenShift masters, nodes, and
# etcd hosts. So automatically add those host names to the openshift_no_proxy list.
# If all of your hosts share a common domain you may wish to disable this and
# specify that domain above.
OpenShift Enterprise node hosts need to perform push and pull operations to Docker
registries. If you have a registry that does not need a proxy for nodes to
access, include the NO_PROXY parameter with the registry’s host name, the
registry service’s IP address, and service name. This blacklists that registry,
leaving the external HTTP proxy as the only option.
Edit the /etc/sysconfig/docker file and add the variables in shell format:
HTTPS_PROXY=USERNAME:PASSWORD@10. 1:8080/, 172. 123. 45,
Restart the Docker service:
# systemctl restart docker
S2I builds fetch dependencies from various locations. You can
use a. s2i/environment file
to specify simple shell variables and OpenShift Enterprise will react accordingly when
seeing build images.
The following are the supported proxy environment variables with example values:
templates available in OpenShift Enterprise by default do not include settings for
HTTP proxies. For existing applications based on these templates, modify the
source section of the application’s build configuration and add proxy
uri: Proxy: Proxy:…
This is similar to the process for using proxies for Git cloning.
You can set the NO_PROXY, HTTP_PROXY, and HTTPS_PROXY environment
variables in the stanza in a deployment
configuration to pass proxy connection information. The same can be done for
configuring a Pod’s proxy at runtime:…
– name: “HTTP_PROXY”
You can also use the oc set env command to update an existing deployment
configuration with a new environment variable:
$ oc set env dc/frontend HTTP_PROXY=USER:PASSWORD@IPADDR:PORT
If you have a ConfigChange trigger
set up in your OpenShift Enterprise instance, the changes happen automatically. Otherwise,
manually redeploy your application for the changes to take effect.
If your Git repository can only be accessed using a proxy, you can define the
proxy to use in the source section of the BuildConfig. You can configure
both a HTTP and HTTPS proxy to use. Both fields are optional.
Your source URI must use the HTTP or HTTPS protocol for this to work.
Frequently Asked Questions about set http_proxy
What is Http_proxy environment variable?
Linux and UNIX-like systems has environment variable called http_proxy. It allows you to connect text based session and/or applications via the proxy server. All you need is proxy server IP address (URL) and port values. This variable is almost used by all utilities such as elinks, lynx, wget, curl and others commands.Jul 13, 2021
Should I set proxy on or off?
It’s basically split into two configurations: either Automatic or Manual proxy setup. In 99% of the cases, everything should be set to Off. If anything is turned on, your web traffic could be going through a proxy.Oct 2, 2017
How do I set HTTP proxy on Windows?
Click on Internet Options. In the connections tab, click on LAN settings in the Local Area Network section. Activate the checkbox Use a proxy server for your LAN and click on Advanced. Enter a Perfect Privacy server of your choice in the HTTP: field and enter 3128 as Port.