|
1 | 1 | ---
|
2 |
| -description: Enable traffic through a proxy server via HTTP_PROXY environment variable |
| 2 | +description: Enable traffic through a proxy server using the HTTP_PROXY environment variable. |
3 | 3 | ---
|
4 | 4 |
|
5 | 5 | # HTTP Proxy
|
6 | 6 |
|
7 |
| -Fluent Bit supports configuring an HTTP proxy for all egress HTTP/HTTPS traffic via the `HTTP_PROXY` or `http_proxy` environment variable. |
| 7 | +Fluent Bit supports configuring an HTTP proxy for all egress HTTP/HTTPS traffic |
| 8 | +using the `HTTP_PROXY` or `http_proxy` environment variable. |
8 | 9 |
|
9 | 10 | The format for the HTTP proxy environment variable is `http://USER:PASS@HOST:PORT`, where:
|
10 | 11 |
|
11 |
| -* `USER` is the username when using basic authentication. |
12 |
| -* `PASS` is the password when using basic authentication. |
13 |
| -* `HOST` is the HTTP proxy hostname or IP address. |
14 |
| -* `PORT` is the port the HTTP proxy is listening on. |
| 12 | +- _`USER`_ is the username when using basic authentication. |
| 13 | +- _`PASS`_ is the password when using basic authentication. |
| 14 | +- _`HOST`_ is the HTTP proxy hostname or IP address. |
| 15 | +- _`PORT`_ is the port the HTTP proxy is listening on. |
15 | 16 |
|
16 | 17 | To use an HTTP proxy with basic authentication, provide the username and password:
|
17 | 18 |
|
18 |
| -```bash |
| 19 | +```text |
19 | 20 | HTTP_PROXY='http://example_user:[email protected]:8080'
|
20 | 21 | ```
|
21 | 22 |
|
22 | 23 | When no authentication is required, omit the username and password:
|
23 | 24 |
|
24 |
| -```bash |
| 25 | +```text |
25 | 26 | HTTP_PROXY='http://proxy.example.com:8080'
|
26 | 27 | ```
|
27 | 28 |
|
28 |
| -The `HTTP_PROXY` environment variable is a [standard way](https://docs.docker.com/network/proxy/#use-environment-variables) for setting a HTTP proxy in a containerized environment, and it is also natively supported by any application written in Go. Therefore, we follow and implement the same convention for Fluent Bit. For convenience and compatibility, the `http_proxy` environment variable is also supported. When both the `HTTP_PROXY` and `http_proxy` environment variables are provided, `HTTP_PROXY` will be preferred. |
| 29 | +The `HTTP_PROXY` environment variable is a [standard |
| 30 | +way](https://docs.docker.com/network/proxy/#use-environment-variables) of setting a |
| 31 | +HTTP proxy in a containerized environment, and it's also natively supported by any |
| 32 | +application written in Go. Fluent Bit implements the same convention. The |
| 33 | +`http_proxy` environment variable is also supported. When both the `HTTP_PROXY` and |
| 34 | +`http_proxy` environment variables are provided, `HTTP_PROXY` will be preferred. |
29 | 35 |
|
30 | 36 | {% hint style="info" %}
|
31 |
| -**Note**: The [HTTP output plugin](https://docs.fluentbit.io/manual/pipeline/outputs/http) also supports configuring an HTTP proxy. This configuration continues to work, however it _should not_ be used together with the `HTTP_PROXY` or `http_proxy` environment variable. This is because under the hood, the environment variable based proxy configuration is implemented by setting up a TCP connection tunnel via [HTTP CONNECT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT). Unlike the plugin's implementation, this supports both HTTP and HTTPS egress traffic. |
| 37 | + |
| 38 | +The [HTTP output plugin](https://docs.fluentbit.io/manual/pipeline/outputs/http) also |
| 39 | +supports configuring an HTTP proxy. This configuration works, but shouldn't be used |
| 40 | +with the `HTTP_PROXY` or `http_proxy` environment variable. The environment |
| 41 | +variable-based proxy configuration is implemented by creating a TCP connection tunnel |
| 42 | +using |
| 43 | +[HTTP CONNECT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT). Unlike |
| 44 | +the plugin's implementation, this supports both HTTP and HTTPS egress traffic. |
| 45 | + |
32 | 46 | {% endhint %}
|
33 | 47 |
|
34 |
| -# NO_PROXY |
| 48 | +## `NO_PROXY` |
35 | 49 |
|
36 |
| -Not all traffic should flow through the HTTP proxy. In this case, the `NO_PROXY` or `no_proxy` environment variable should be used. |
| 50 | +Use the `NO_PROXY` environment variable when traffic shouldn't flow through the HTTP |
| 51 | +proxy. The `no_proxy` environment variable is also supported. When both `NO_PROXY` |
| 52 | +and `no_proxy` environment variables are provided, `NO_PROXY` takes precedence. |
37 | 53 |
|
38 |
| -The format for the no proxy environment variable is a comma-separated list of hostnames or IP addresses whose traffic should not flow through the HTTP proxy. |
| 54 | +The format for the `no_proxy` environment variable is a comma-separated list of |
| 55 | +host names or IP addresses. |
39 | 56 |
|
40 |
| -A domain name matches itself and all its subdomains (i.e. `foo.com` matches `foo.com` and `bar.foo.com`): |
| 57 | +A domain name matches itself and all of its subdomains (for example, `example.com` |
| 58 | +matches both `example.com` and `test.example.com`): |
41 | 59 |
|
42 |
| -```bash |
| 60 | +```text |
43 | 61 | NO_PROXY='foo.com,127.0.0.1,localhost'
|
44 | 62 | ```
|
45 | 63 |
|
46 |
| -A domain with a leading `.` only matches its subdomains (i.e. `.foo.com` matches `bar.foo.com` but not `foo.com`): |
| 64 | +A domain with a leading dot (`.`) matches only its subdomains (for example, |
| 65 | +`.example.com` matches `test.example.com` but not `example.com`): |
47 | 66 |
|
48 |
| -```bash |
49 |
| -NO_PROXY='.foo.com,127.0.0.1,localhost' |
| 67 | +```text |
| 68 | +NO_PROXY='.example.com,127.0.0.1,localhost' |
50 | 69 | ```
|
51 | 70 |
|
52 |
| -One typical use case for `NO_PROXY` is when running Fluent Bit in a Kubernetes environment, where we want: |
| 71 | +As an example, you might use `NO_PROXY` when running Fluent Bit in a Kubernetes |
| 72 | +environment, where and you want: |
53 | 73 |
|
54 |
| -* All real egress traffic to flow through an HTTP proxy. |
55 |
| -* All local Kubernetes traffic to not flow through the HTTP proxy. |
| 74 | +- All real egress traffic to flow through an HTTP proxy. |
| 75 | +- All local Kubernetes traffic to not flow through the HTTP proxy. |
56 | 76 |
|
57 |
| -In this case, we can set: |
| 77 | +In this case, set: |
58 | 78 |
|
59 |
| -```bash |
| 79 | +```text |
60 | 80 | NO_PROXY='127.0.0.1,localhost,kubernetes.default.svc'
|
61 | 81 | ```
|
62 |
| - |
63 |
| -For convenience and compatibility, the `no_proxy` environment variable is also supported. When both the `NO_PROXY` and `no_proxy` environment variables are provided, `NO_PROXY` will be preferred. |
|
0 commit comments