-
-
Notifications
You must be signed in to change notification settings - Fork 219
/
default_frontend.cfg
73 lines (66 loc) · 3.04 KB
/
default_frontend.cfg
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
global
maxconn 60000
spread-checks 5
lua-load-per-thread /usr/local/etc/haproxy/parse_basic.lua
lua-load-per-thread /usr/local/etc/haproxy/parse_cookie.lua
lua-load-per-thread /usr/local/etc/haproxy/replace_password.lua
log stdout len 65535 local2 debug
tune.bufsize 32768
tune.buffers.limit 60000
http-errors json
errorfile 200 /usr/local/etc/haproxy/errors/200-json.http
errorfile 400 /usr/local/etc/haproxy/errors/400-json.http
errorfile 401 /usr/local/etc/haproxy/errors/401-json.http
errorfile 403 /usr/local/etc/haproxy/errors/403-json.http
errorfile 404 /usr/local/etc/haproxy/errors/404-json.http
errorfile 405 /usr/local/etc/haproxy/errors/405-json.http
errorfile 407 /usr/local/etc/haproxy/errors/407-json.http
errorfile 408 /usr/local/etc/haproxy/errors/408-json.http
errorfile 410 /usr/local/etc/haproxy/errors/410-json.http
errorfile 413 /usr/local/etc/haproxy/errors/413-json.http
errorfile 421 /usr/local/etc/haproxy/errors/421-json.http
errorfile 422 /usr/local/etc/haproxy/errors/422-json.http
errorfile 425 /usr/local/etc/haproxy/errors/425-json.http
errorfile 429 /usr/local/etc/haproxy/errors/429-json.http
errorfile 500 /usr/local/etc/haproxy/errors/500-json.http
errorfile 501 /usr/local/etc/haproxy/errors/501-json.http
errorfile 502 /usr/local/etc/haproxy/errors/502-json.http
errorfile 503 /usr/local/etc/haproxy/errors/503-json.http
errorfile 504 /usr/local/etc/haproxy/errors/504-json.http
defaults
mode http
option http-ignore-probes
option httplog
option forwardfor
option redispatch
option http-keep-alive
timeout client 15000000
timeout server 360000000
timeout connect 1500000
timeout http-keep-alive 5m
errorfiles json
stats enable
stats refresh 30s
stats auth $COUCHDB_USER:$COUCHDB_PASSWORD
stats uri /haproxy?stats
resolvers docker_resolver
nameserver dns 127.0.0.11:53
frontend http-in
bind $HAPROXY_IP:$HAPROXY_PORT
acl has_user req.hdr(x-medic-user) -m found
acl has_cookie req.hdr(cookie) -m found
acl has_basic_auth req.hdr(authorization) -m found
declare capture request len 400000
http-request set-header x-medic-user %[lua.parseBasic] if has_basic_auth
http-request set-header x-medic-user %[lua.parseCookie] if !has_basic_auth !has_user has_cookie
http-request capture req.body id 0 # capture.req.hdr(0)
http-request capture req.hdr(x-medic-service) len 200 # capture.req.hdr(1)
http-request capture req.hdr(x-medic-user) len 200 # capture.req.hdr(2)
http-request capture req.hdr(user-agent) len 600 # capture.req.hdr(3)
http-request capture req.hdr(x-request-id) len 12 # capture.req.hdr(4)
capture response header Content-Length len 10 # capture.res.hdr(0)
http-response set-header Connection Keep-Alive
http-response set-header Keep-Alive timeout=18000
log global
log-format "%ci,%s,%ST,%Ta,%Ti,%TR,%[capture.req.method],%[capture.req.uri],%[capture.req.hdr(1)],%[capture.req.hdr(2)],%[capture.req.hdr(4)],'%[capture.req.hdr(0),lua.replacePassword]',%B,%Tr,%[capture.res.hdr(0)],'%[capture.req.hdr(3)]'"
default_backend couchdb-servers