-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaproxy.conf.in
121 lines (90 loc) · 3.7 KB
/
haproxy.conf.in
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
global
log 127.0.0.1 local6
maxconn ${haproxy-conf:maxconn}
user ${haproxy-conf:user}
group ${haproxy-conf:group}
daemon
nbproc 1
defaults
mode http
option httpclose
# Remove requests from the queue if people press stop button
option abortonclose
# option transparent
# Try to connect this many times on failure
retries 10
# If a client is bound to a particular backend but it goes down,
# send them to a different one
option redispatch
timeout connect 5s
timeout queue 60s
timeout client 60s
timeout server 60s
# Enable status page at this URL, on the port HAProxy is bound to
stats enable
stats uri /haproxy-status
stats refresh 5m
stats realm Haproxy\ statistics
# The main frontend forwards requests to one sepcific mirror frontend.
# This necessary for rewriting the Host header which is not possible with haproxy otherwise.
frontend pypi
bind ${haproxy-conf:bind}
default_backend pypi-mirrors
backend pypi-mirrors
# Add a cookie called "serverid" for maintaining session stickiness.
# This cookie lasts until the client's browser closes.
cookie serverid insert nocache indirect
# Use / (the default) for periodic backend health checks
option httpchk HEAD / HTTP/1.0
# Server options:
# "cookie" sets the value of the serverid cookie to be used for the server
# "maxconn" is how many connections can be sent to the server at once
# "check" enables health checks
# "rise 1" means consider server up after 1 successful health check
server pypi-mirror-a ${haproxy-conf:bind-pypia} cookie ppa check inter 5m fastinter 2s downinter 1m maxconn 2 rise 1 fall 1
server pypi-mirror-c ${haproxy-conf:bind-pypic} cookie ppc check inter 5m fastinter 2s downinter 1m maxconn 2 rise 1 fall 1
server pypi-mirror-d ${haproxy-conf:bind-pypid} cookie ppd check inter 5m fastinter 2s downinter 1m maxconn 2 rise 1 fall 1
server pypi-mirror-e ${haproxy-conf:bind-pypie} cookie ppe check inter 5m fastinter 2s downinter 1m maxconn 2 rise 1 fall 1
server pypi-mirror-f ${haproxy-conf:bind-pypif} cookie ppf check inter 5m fastinter 2s downinter 1m maxconn 2 rise 1 fall 1
# a.pypi.python.org
frontend pypia
bind ${haproxy-conf:bind-pypia}
default_backend pypia-backend
backend pypia-backend
reqirep ^(Host:\s*) \1a.pypi.python.org
rspirep ^(Location:.*)a.pypi.python.org(.*) \1${haproxy-conf:bind-incoming}\2
server pypia-server a.pypi.python.org:80
# b.pypi.python.org
# This mirror is utterly broken. It does not support neither OPTION nor HEAD checks.
# c.pypi.python.org
frontend pypic
bind ${haproxy-conf:bind-pypic}
default_backend pypic-backend
backend pypic-backend
reqirep ^(Host:\s*) \1c.pypi.python.org
rspirep ^(Location:.*)c.pypi.python.org(.*) \1${haproxy-conf:bind-incoming}\2
server pypic-server c.pypi.python.org:80
# d.pypi.python.org
frontend pypid
bind ${haproxy-conf:bind-pypid}
default_backend pypid-backend
backend pypid-backend
reqirep ^(Host:\s*) \1d.pypi.python.org
rspirep ^(Location:.*)d.pypi.python.org(.*) \1${haproxy-conf:bind-incoming}\2
server pypid-server d.pypi.python.org:80
# e.pypi.python.org
frontend pypie
bind ${haproxy-conf:bind-pypie}
default_backend pypie-backend
backend pypie-backend
reqirep ^(Host:\s*) \1e.pypi.python.org
rspirep ^(Location:.*)e.pypi.python.org(.*) \1${haproxy-conf:bind-incoming}\2
server pypie-server e.pypi.python.org:80
# f.pypi.python.org
frontend pypif
bind ${haproxy-conf:bind-pypif}
default_backend pypif-backend
backend pypif-backend
reqirep ^(Host:\s*) \1f.pypi.python.org
rspirep ^(Location:.*)f.pypi.python.org(.*) \1${haproxy-conf:bind-incoming}\2
server pypif-server f.pypi.python.org:80