You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,12 +21,13 @@ The following environment variables can be used to configure the *Docker Flow Pr
21
21
|COMPRESSION_TYPE |The type of files that will be compressed.<br>**Example:** text/css text/html text/javascript application/javascript text/plain text/xml application/json|
22
22
|CONNECTION_MODE |HAProxy supports 5 connection modes.<br><br>`http-keep-alive`: all requests and responses are processed.<br>`http-tunnel`: only the first request and response are processed, everything else is forwarded with no analysis.<br>`httpclose`: tunnel with "Connection: close" added in both directions.<br>`http-server-close`: the server-facing connection is closed after the response.<br>`forceclose`: the connection is actively closed after end of response.<br><br>In general, it is preferred to use `http-server-close` with application servers, and some static servers might benefit from `http-keep-alive`.<br>**Example:**`http-server-close`<br>**Default value:**`http-keep-alive`|
23
23
|DEBUG |Enables logging of each request sent through the proxy. Please consult [Debug Format](#debug-format) for info about the log entries. This feature should be used with caution. **Do not enable debugging in production unless necessary.**<br>**Example:** true<br>**Default value:**`false`|
24
-
|DEBUG_ERRORS_ONLY |If set to `true`, only requests that resulted in an error, timeout, retry, and redispatch will be logged. If a request is HTTP, responses with a status 5xx will be logged too. This variable will take effect only if `DEBUG` is set to `true`.<br>**Example:** true<br>**Default value:**`false`|
24
+
|DEBUG_ERRORS_ONLY |If set to `true`, only requests that resulted in an error, timeout, retry, and redispatch will be logged. If a request is HTTP, responses with a status 5xx will be logged too. This variable will take effect only if `DEBUG` is set to `true`.<br>**Example:**`true`<br>**Default value:**`false`|
25
25
|DEBUG_HTTP_FORMAT |Logging format that will be used with HTTP requests. Please consult [Custom log format](https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.4) for more info about the available options.|
26
26
|DEBUG_TCP_FORMAT |Logging format that will be used with TCP requests. Please consult [Custom log format](https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.4) for more info about the available options.|
27
27
|DEFAULT_PORTS |The default ports used by the proxy. Multiple values can be separated with comma (`,`). If a port should be for SSL connections, append it with `:ssl`. Additional binding options can be added after a port. For example, `80 accept-proxy,443 accept-proxy:ssl` adds `accept-proxy` to the defalt binding options.<br>**Default value:**`80,443:ssl`|
28
28
|DEFAULT_REQ_MODE |The default request mode used by the proxy.<br>**Default value:**`http`|
29
29
|DO_NOT_RESOLVE_ADDR|Whether not to resolve addresses. If set to `true`, the proxy will NOT fail if the service is not available.<br>**Default value:**`false`|
30
+
|ENABLE_H2 |Whether to enable http/2<br>**Example:**`false`<br>**Default:**`true`|
30
31
|EXTRA_FRONTEND |Value will be added to the default `frontend` configuration. Multiple lines should be separated with comma (*,*).|
31
32
|EXTRA_GLOBAL |Value will be added to the default `global` configuration. Multiple lines should be separated with comma (*,*).|
32
33
|HTTPS_ONLY |If set to true, all requests to all services will be redirected to HTTPS.<br>**Example:**`true`<br>**Default Value:**`false`|
Copy file name to clipboardExpand all lines: docs/swarm-mode-auto.md
+7-16Lines changed: 7 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,6 @@ docker service create --name go-demo \
102
102
--network go-demo \
103
103
--network proxy \
104
104
--label com.df.notify=true \
105
-
--label com.df.distribute=true \
106
105
--label com.df.servicePath=/demo \
107
106
--label com.df.port=8080 \
108
107
vfarcic/go-demo
@@ -139,7 +138,7 @@ We sent a request to the proxy (the only service listening to the port 80) and g
139
138
140
139
The way the process works is as follows.
141
140
142
-
[Docker Flow: Swarm Listener](https://github.com/vfarcic/docker-flow-swarm-listener) is running inside one of the Swarm manager nodes and queries Docker API in search for newly created services. Once it finds a new service, it looks for its labels. If the service contains the `com.df.notify` (it can hold any value), the rest of the labels with keys starting with `com.df.` are retrieved. All those labels are used to form request parameters. Those parameters are appended to the address specified as the `DF_NOTIFY_CREATE_SERVICE_URL` environment variable defined in the `swarm-listener` service. Finally, a request is sent. In this particular case, the request was made to reconfigure the proxy with the service `go-demo` (the name of the service), using `/demo` as the path, and running on the port `8080`. The `distribute` label is not necessary in this example since we're running only a single instance of the proxy. However, in production we should run at least two proxy instances (for fault tolerance) and the `distribute` argument means that reconfiguration should be applied to all.
141
+
[Docker Flow: Swarm Listener](https://github.com/vfarcic/docker-flow-swarm-listener) is running inside one of the Swarm manager nodes and queries Docker API in search for newly created services. Once it finds a new service, it looks for its labels. If the service contains the `com.df.notify` (it can hold any value), the rest of the labels with keys starting with `com.df.` are retrieved. All those labels are used to form request parameters. Those parameters are appended to the address specified as the `DF_NOTIFY_CREATE_SERVICE_URL` environment variable defined in the `swarm-listener` service. Finally, a request is sent. In this particular case, the request was made to reconfigure the proxy with the service `go-demo` (the name of the service), using `/demo` as the path, and running on the port `8080`.
143
142
144
143
Please see the [Reconfigure](usage.md#reconfigure) section for the list of all the arguments that can be used with the proxy.
145
144
@@ -231,7 +230,6 @@ docker service create --name go-demo \
231
230
--network go-demo \
232
231
--network proxy \
233
232
--label com.df.notify=true \
234
-
--label com.df.distribute=true \
235
233
--label com.df.servicePath=/demo \
236
234
--label com.df.port=8080 \
237
235
--replicas 3 \
@@ -336,9 +334,9 @@ From now on, the username and password are `secret-user` and `secret-pass`. Unli
336
334
337
335
## Rewriting Paths
338
336
339
-
In some cases, you might want to rewrite the path of the incoming request before forwarding it to the destination service. We can do that using request parameters `reqPathSearch` and `reqPathReplace`.
337
+
In some cases, you might want to rewrite the path of the incoming request before forwarding it to the destination service. We can do that using request parameter `reqPathSearchReplace`.
340
338
341
-
As an example, we'll create the `go-demo` service that will be configured in the proxy to accept requests with the path starting with `/something`. Since the `go-demo` service allows only requests that start with `/demo`, we'll use `reqPathSearch` and `reqPathReplace` to rewrite the path.
339
+
As an example, we'll create the `go-demo` service that will be configured in the proxy to accept requests with the path starting with `/something`. Since the `go-demo` service allows only requests that start with `/demo`, we'll use `reqPathSearchReplace` to rewrite the path.
342
340
343
341
The command is as follows.
344
342
@@ -350,16 +348,14 @@ docker service create --name go-demo \
Please notice that, this time, the `servicePath` is `/something`. The `reqPathSearch` specifies the regular expression that will be used to search for part of the address and the `reqPathReplace` will replace it. In this case, `/something/` will be replaced with `/demo/`. The proxy uses the *regsub* function within the *http-request set-path* directive to apply a regex-based substitution which operates as the well-known *sed* utility with `"s/<regex>/<subst>/"`. For more information, please consult [Configuration: 4.2 http-request](https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#4.2-http-request) and [Configuration: 7.3.1 regsub](https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#7.3.1-regsub).
358
+
The `reqPathSearchReplace` specifies the regular expression that will be used to search for part of the address and replace it. In this case, `/something/` will be replaced with `/demo/`. The proxy uses the *regsub* function within the *http-request set-path* directive to apply a regex-based substitution which operates as the well-known *sed* utility with `"s/<regex>/<subst>/"`. For more information, please consult [Configuration: 4.2 http-request](https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#4.2-http-request) and [Configuration: 7.3.1 regsub](https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#7.3.1-regsub).
363
359
364
360
Please wait a few moments until the `go-demo` service is running. You can see the status of the service by executing `docker service ps go-demo`.
365
361
@@ -382,12 +378,11 @@ hello, world!
382
378
383
379
We sent a request to `/something/hello`. The proxy accepted the request, rewrote the path to `/demo/hello`, and forwarded it to the `go-demo` service.
384
380
385
-
The `reqPathSearch` label accepts regular expressions. We can, for example, rewrite any path that starts with `/something/` to `/demo/hello`.
381
+
The `reqPathSearchReplace` label accepts regular expressions. We can, for example, rewrite any path that starts with `/something/` to `/demo/hello`.
Copy file name to clipboardExpand all lines: docs/swarm-mode-stack.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,7 +141,6 @@ services:
141
141
replicas: 3
142
142
labels:
143
143
- com.df.notify=true
144
-
- com.df.distribute=true
145
144
- com.df.servicePath=/demo
146
145
- com.df.port=8080
147
146
@@ -190,6 +189,8 @@ Since Mongo database is much bigger than the `main` service, it takes more time
190
189
After a few moments, the `swarm-listener` service will detect the `main` service from the `go-demo` stack and send the `proxy` a request to reconfigure itself. We can see the result by sending an HTTP request to the proxy.
0 commit comments