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 via the http_proxy and/or https_proxy environment variables. These should be set to the proxy hostname and/or port.

All of the buildpacks will automatically utilize these proxy environment variables correctly. If any of them contact the internet during staging, it will be through the proxy host. The binary buildpack will not use a proxy because it does not use the internet at all during staging.

To set a proxy to be used by buildpacks 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 file:
    ---
      env:
        http_proxy: http://YOUR-HTTP-PROXY:PORT
        https_proxy: 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 http_proxy "http://YOUR-HTTP-PROXY:PORT"
    $ cf set-env YOUR-APP https_proxy "https://YOUR-HTTPs-PROXY:PORT"
    

Note: While many applications will use the http_proxy and https_proxy environment variables at runtime, this depends on the application. The buildpack does not add any extra functionality to make proxies work at runtime.

Create a pull request or raise an issue on the source for this page in GitHub