forked from cloudfoundry/docs-buildpacks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxy-usage.html.md.erb
47 lines (38 loc) · 2.03 KB
/
proxy-usage.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: Using a Proxy Server
owner: Buildpacks
---
This topic describes how developers can use a proxy server with the buildpacks for their application.
##<a id='proxy-usage'></a> Use a Proxy
You can assign proxy servers to environment variables. Proxy servers can be used to monitor your application's traffic or to fetch your application's dependencies.
A buildpack uses a proxy server if that buildpack contacts the internet during staging.
<p class="note"><strong>Note:</strong> The binary buildpack does not use a proxy server because it does not access the internet during staging.
</p>
##<a id='env-variable'></a> Setting environment variables
<p class="note"><strong>Note</strong>: If you are using the Java buildpack, the <code>http_proxy</code> and <code>https_proxy</code> environment variables are not supported at runtime. The Java buildpack does not add the functionality to make proxies work at runtime.</p>
1. Add the following section to the `env` block of your application manifest YAML file:
<pre><code>---
env:
http_proxy: http<span>://</span>YOUR-HTTP-PROXY:PORT
https_proxy: https<span>://</span>YOUR-HTTPS-PROXY:PORT
</code></pre>
Where:
</br>
<ul>
<li> `YOUR-HTTP-PROXY` is the address of your proxy server for HTTP requests.</li>
<li> `YOUR-HTTPS-PROXY` is the address of your proxy server for HTTPS requests.</li>
<li> `PORT` is the port number you are using for your proxy server.</li>
</ul>
1. Set the environment variables with the Cloud Foundry Command Line Interface's (cf CLI) `cf set-env` command:
<pre class="terminal">
$ cf set-env YOUR-APP http_proxy "http<span>://</span>YOUR-HTTP-PROXY:PORT"
$ cf set-env YOUR-APP https_proxy "https<span>://</span>YOUR-HTTPs-PROXY:PORT"
</pre>
Where:
</br>
<ul>
<li> `YOUR-APP` is the name of your application.</li>
<li> `YOUR-HTTP-PROXY` is the address of your proxy server for HTTP requests.</li>
<li> `YOUR-HTTPS-PROXY` is the address of your proxy server for HTTPS requests.</li>
<li> `PORT` is the port number you are using for your proxy server.</li>
</ul>