1 |
3a515b92
|
cagy
|
# Requires recent Haproxy to work with websockets (for example 1.4.16).
|
2 |
|
|
defaults
|
3 |
|
|
mode http
|
4 |
|
|
# Set timeouts to your needs
|
5 |
|
|
timeout client 5s
|
6 |
|
|
timeout connect 5s
|
7 |
|
|
timeout server 5s
|
8 |
|
|
|
9 |
|
|
frontend all 0.0.0.0:8888
|
10 |
|
|
mode http
|
11 |
|
|
timeout client 120s
|
12 |
|
|
|
13 |
|
|
option forwardfor
|
14 |
|
|
# Fake connection:close, required in this setup.
|
15 |
|
|
option http-server-close
|
16 |
|
|
option http-pretend-keepalive
|
17 |
|
|
|
18 |
|
|
acl is_sockjs path_beg /echo /broadcast /close
|
19 |
|
|
acl is_stats path_beg /stats
|
20 |
|
|
|
21 |
|
|
use_backend sockjs if is_sockjs
|
22 |
|
|
use_backend stats if is_stats
|
23 |
|
|
default_backend static
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
backend sockjs
|
27 |
|
|
# Load-balance according to hash created from first two
|
28 |
|
|
# directories in url path. For example requests going to /1/
|
29 |
|
|
# should be handled by single server (assuming resource prefix is
|
30 |
|
|
# one-level deep, like "/echo").
|
31 |
|
|
balance uri depth 2
|
32 |
|
|
timeout server 120s
|
33 |
|
|
server srv_sockjs1 127.0.0.1:9999
|
34 |
|
|
# server srv_sockjs2 127.0.0.1:9998
|
35 |
|
|
|
36 |
|
|
backend static
|
37 |
|
|
balance roundrobin
|
38 |
|
|
server srv_static 127.0.0.1:8000
|
39 |
|
|
|
40 |
|
|
backend stats
|
41 |
|
|
stats uri /stats
|
42 |
|
|
stats enable
|