-
Notifications
You must be signed in to change notification settings - Fork 119
/
proxy-usage.html.md.erb
77 lines (54 loc) · 2.64 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
title: Using a proxy server with Cloud Foundry buildpacks
owner: Buildpacks
---
You can use a proxy server with buildpacks for your application.
## <a id='proxy-usage'></a> Using a proxy server
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.
The binary buildpack does not use a proxy server because it does not access the internet during staging.
## <a id='env-variable'></a> Setting environment variables
If you are using a 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.
To set your environment variables:
1. Add the following to the `env` block of your application manifest YAML file:
```yaml
---
env:
http_proxy: http://YOUR-HTTP-PROXY:PORT
https_proxy: https://YOUR-HTTPS-PROXY:PORT
```
Where:
<ul>
<li><code>YOUR-HTTP-PROXY</code> is the address of your proxy server for HTTP requests.</li>
<li><code>YOUR-HTTPS-PROXY</code> is the address of your proxy server for HTTPS requests.</li>
<li><code>PORT</code> 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 (cf CLI) `cf set-env` command:
```console
cf set-env YOUR-APP http_proxy "http://YOUR-HTTP-PROXY:PORT"
```
```console
cf set-env YOUR-APP https_proxy "https://YOUR-HTTPS-PROXY:PORT"
```
Where:
<ul>
<li><code>YOUR-APP</code> is the name of your application.</li>
<li><code>YOUR-HTTP-PROXY</code> is the address of your proxy server for HTTP requests.</li>
<li><code>YOUR-HTTPS-PROXY</code> is the address of your proxy server for HTTPS requests.</li>
<li><code>PORT</code> is the port number you are using for your proxy server.</li>
</ul>
## <a id='unset-env-variable'></a> Un-setting environment variables
Removing an environment variable from the application manifest YAML file is not sufficient to unset the environment variable.
You must also unset the environment variables with the Cloud Foundry Command Line Interface (cf CLI) `cf unset-env` command:
```console
cf unset-env YOUR-APP ENV_VAR_NAME
```
For example:
```console
cf unset-env YOUR-APP https_proxy
```
Where:
<ul>
<li><code>YOUR-APP</code> is the name of your application.</li>
<li><code>ENV_VAR_NAME</code> is the name of the environment variable.</li>
</ul>