Skip to content

Commit a41ce2c

Browse files
committed
Adding ENV's for Default Router timeout settings, and adding validation
1 parent 1c80911 commit a41ce2c

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

images/router/haproxy/conf/haproxy-config.template

+22-5
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,34 @@ defaults
3939
option httplog
4040
log global
4141
{{ end }}
42+
43+
{{ if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_DEFAULT_CONNECT_TIMEOUT" "")) }}
44+
timeout connect {{env "ROUTER_DEFAULT_CONNECT_TIMEOUT" "5s"}}
45+
{{ else }}
46+
timeout connect 5s
47+
{{ end }}
48+
{{ if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_DEFAULT_CLIENT_TIMEOUT" "")) }}
49+
timeout client {{env "ROUTER_DEFAULT_CLIENT_TIMEOUT" "30s"}}
50+
{{ else }}
51+
timeout connect 30s
52+
{{ end }}
53+
{{ if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_DEFAULT_SERVER_TIMEOUT" "")) }}
54+
timeout server {{env "ROUTER_DEFAULT_SERVER_TIMEOUT" "30s"}}
55+
{{ else }}
56+
timeout server 30s
57+
{{ end }}
4258
{{ if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_SLOWLORIS_TIMEOUT" "")) }}
43-
timeout http-request {{env "ROUTER_SLOWLORIS_TIMEOUT" "" }}
59+
timeout http-request {{env "ROUTER_SLOWLORIS_TIMEOUT" "10s" }}
4460
{{ else }}
4561
timeout http-request 10s
4662
{{ end }}
47-
timeout http-keep-alive 30s
48-
timeout connect 5s
49-
timeout client 30s
50-
timeout server 30s
63+
5164
# Long timeout for WebSocket connections.
65+
{{ if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" (env "ROUTER_DEFAULT_TUNNEL_TIMEOUT" "")) }}
66+
timeout tunnel {{env "ROUTER_DEFAULT_TUNNEL_TIMEOUT" "1h" }}
67+
{{ else }}
5268
timeout tunnel 1h
69+
{{ end }}
5370

5471
{{ if (gt .StatsPort 0) }}
5572
listen stats :{{.StatsPort}}

0 commit comments

Comments
 (0)