Using a Proxy

Page last updated:

This topic describes how developers can use a proxy with the buildpacks for their application.

Use a Proxy

Buildpacks can use proxies using the http_proxy and https_proxy environment variables. You should set these to the proxy hostname or port.

All of the buildpacks automatically use these proxy environment variables correctly. If any buildpacks contacts the Internet during staging, it does so through the proxy host. The binary buildpack does not use a proxy because it does not use the Internet during staging.

To set a proxy for buildpacks to use during staging, perform one of the following procedures:

  • Set the environment variables by adding the following section to the env block of the application manifest:
        httpproxy: http://YOUR-HTTP-PROXY:PORT
        httpsproxy: https://YOUR-HTTPS-PROXY:PORT
  • Set the environment variables with the Cloud Foundry Command Line Interface (cf CLI) using the cf set-env command:
    $ cf set-env YOUR-APP httpproxy "http://YOUR-HTTP-PROXY:PORT"
    $ cf set-env YOUR-APP httpsproxy "https://YOUR-HTTPs-PROXY:PORT"

Note: While many apps use the http_proxy and https_proxy environment variables at runtime, some do not. The buildpack does not add extra functionality to make proxies work at runtime.

View the source for this page in GitHub