Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 43 additions & 25 deletions administration/http-proxy.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,81 @@
---
description: Enable traffic through a proxy server via HTTP_PROXY environment variable
description: Enable traffic through a proxy server using the HTTP_PROXY environment variable.
---

# HTTP Proxy

Fluent Bit supports configuring an HTTP proxy for all egress HTTP/HTTPS traffic via the `HTTP_PROXY` or `http_proxy` environment variable.
Fluent Bit supports configuring an HTTP proxy for all egress HTTP/HTTPS traffic
using the `HTTP_PROXY` or `http_proxy` environment variable.

The format for the HTTP proxy environment variable is `http://USER:PASS@HOST:PORT`, where:

* `USER` is the username when using basic authentication.
* `PASS` is the password when using basic authentication.
* `HOST` is the HTTP proxy hostname or IP address.
* `PORT` is the port the HTTP proxy is listening on.
- _`USER`_ is the username when using basic authentication.
- _`PASS`_ is the password when using basic authentication.
- _`HOST`_ is the HTTP proxy hostname or IP address.
- _`PORT`_ is the port the HTTP proxy is listening on.

To use an HTTP proxy with basic authentication, provide the username and password:

```bash
```text
HTTP_PROXY='http://example_user:[email protected]:8080'
```

When no authentication is required, omit the username and password:

```bash
```text
HTTP_PROXY='http://proxy.example.com:8080'
```

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.
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's also natively supported by any
application written in Go. Fluent Bit implements the same convention. 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.

{% hint style="info" %}
**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.

The [HTTP output plugin](https://docs.fluentbit.io/manual/pipeline/outputs/http) also
supports configuring an HTTP proxy. This configuration works, but shouldn't be used
with the `HTTP_PROXY` or `http_proxy` environment variable. The environment
variable-based proxy configuration is implemented by creating a TCP connection tunnel
using
[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.

{% endhint %}

# NO_PROXY
## `NO_PROXY`

Not all traffic should flow through the HTTP proxy. In this case, the `NO_PROXY` or `no_proxy` environment variable should be used.
Use the `NO_PROXY` environment variable when traffic shouldn't flow through the HTTP
proxy. The `no_proxy` environment variable is also supported. When both `NO_PROXY`
and `no_proxy` environment variables are provided, `NO_PROXY` takes precedence.

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.
The format for the `no_proxy` environment variable is a comma-separated list of
host names or IP addresses.

A domain name matches itself and all its subdomains (i.e. `foo.com` matches `foo.com` and `bar.foo.com`):
A domain name matches itself and all its subdomains (for example:`example.com` matches
`example.com` and `test.example.com`):

```bash
```text
NO_PROXY='foo.com,127.0.0.1,localhost'
```

A domain with a leading `.` only matches its subdomains (i.e. `.foo.com` matches `bar.foo.com` but not `foo.com`):
A domain with a leading dot (`.`) only matches its subdomains (for example:
`.example.com` matches `test.example.com` but not `example.com`):

```bash
NO_PROXY='.foo.com,127.0.0.1,localhost'
```text
NO_PROXY='.example.com,127.0.0.1,localhost'
```

One typical use case for `NO_PROXY` is when running Fluent Bit in a Kubernetes environment, where we want:
As an example, you might use `NO_PROXY` when running Fluent Bit in a Kubernetes
environment, where and you want:

* All real egress traffic to flow through an HTTP proxy.
* All local Kubernetes traffic to not flow through the HTTP proxy.
- All real egress traffic to flow through an HTTP proxy.
- All local Kubernetes traffic to not flow through the HTTP proxy.

In this case, we can set:
In this case, set:

```bash
```text
NO_PROXY='127.0.0.1,localhost,kubernetes.default.svc'
```

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.
1 change: 0 additions & 1 deletion vale-styles/FluentBit/WordList.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ swap:
Android device: Android-powered device
android: Android
API explorer: APIs Explorer
application: app
approx\.: approximately
as well as: and
authN: authentication
Expand Down