Using PCF Dev Behind a Proxy

Page last updated:

This topic describes how to use PCF Dev with a proxy.

Run PCF Dev Behind an HTTP Proxy

In a restricted network environment, configuring PCF Dev to connect to an HTTP proxy permits app-to-Internet connectivity, access to custom buildpacks, and the use of Docker images from the public Internet.

To run PCF Dev behind a proxy, set the standard proxy environment variables for your platform before you start PCF Dev:

  • Using Mac OS X or Linux:
    $ HTTP_PROXY=http://PROXY_IP:PROXY_PORT \
    > HTTPS_PROXY=http://PROXY_IP:PROXY_PORT \
    > cf dev start
    
  • Using Windows PowerShell:
    >> $env:HTTP_PROXY = "http://PROXY_IP:PROXY_PORT"
    >> $env:HTTPS_PROXY = "http://PROXY_IP:PROXY_PORT"
    >> cf dev start
    

Note: Do not use localhost for PROXY_IP or as the proxy server hostname, because localhost refers to the PCF Dev VM itself. If PCF Dev needs to use a locally-running HTTP proxy, the proxy must be listening on all network interfaces, and you must address it as host.cfdev.sh. For a system domain dev.cfdev.sh, address the proxy as host.cfdev.sh, and so on.

Use the cf CLI Behind an HTTP Proxy

You must configure the cf CLI to bypass your HTTP proxy for addresses that end in local.pcfdev.io, which is your system domain:

  • For Mac OS X or Linux:
    $ export NO_PROXY=.dev.cfdev.sh,dev.cfdev.sh,$NO_PROXY
    $ cf login -a https://api.dev.cfdev.sh --skip-ssl-validation
    
  • For Windows PowerShell:
    >> $env:NO_PROXY = ".dev.cfdev.sh,dev.cfdev.sh,OTHER-DOMAINS"
    >> cf login -a https://api.ldev.cfdev.sh --skip-ssl-validation
    

Allow Application Traffic to Bypass the Proxy

You can configure your apps to connect to other addresses without using the proxy. For example, you can connect apps to user-provided services on a private network.

  • Set the NO_PROXY environment variable to a comma-separated list of hosts:
    $ cf set-env APP_NAME NO_PROXY=192.0.2.54,198.51.100.34
    
Create a pull request or raise an issue on the source for this page in GitHub