-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathhaproxy.cfg
More file actions
68 lines (50 loc) · 2.58 KB
/
Copy pathhaproxy.cfg
File metadata and controls
68 lines (50 loc) · 2.58 KB
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
global
log stdout format raw local0
tune.bufsize 32768
defaults
mode http
log global
timeout client 5s
timeout server 5s
timeout connect 5s
frontend e2e
bind 127.0.0.1:18080
# Keep the test deterministic: every request is challenged at the fixed
# test level instead of depending on a production rate-limit stick table.
http-request set-var(req.berghain.level) int(1)
filter spoe engine berghain config examples/haproxy/berghain.cfg
acl berghain_path path /cdn-cgi/challenge-platform/challenge
http-request send-spoe-group berghain validate if !berghain_path
http-request return status 501 if { var(txn.berghain.error) -m found }
acl berghain_valid var(txn.berghain.valid) -m bool
http-request return status 403 content-type "text/html" file "web/dist/default/index.html" if !berghain_valid !berghain_path
http-request wait-for-body time 5s if berghain_path METH_POST
use_backend berghain_http if berghain_path
default_backend app_backend
frontend e2e_turnstile
bind 127.0.0.1:18081
http-request set-var(req.berghain.level) int(1)
filter spoe engine berghain config examples/haproxy/berghain.cfg
acl berghain_path path /cdn-cgi/challenge-platform/challenge
http-request send-spoe-group berghain validate if !berghain_path
http-request return status 501 if { var(txn.berghain.error) -m found }
acl berghain_valid var(txn.berghain.valid) -m bool
http-request return status 403 content-type "text/html" file "web/dist/default/index.html" if !berghain_valid !berghain_path
http-request wait-for-body time 5s if berghain_path METH_POST
use_backend berghain_http if berghain_path
default_backend app_backend
backend app_backend
http-request return status 200 content-type "text/plain" string "Berghain E2E backend reached"
backend berghain_http
filter spoe engine berghain_challenge config examples/haproxy/berghain.cfg
acl is_challenge_path path /cdn-cgi/challenge-platform/challenge
http-request send-spoe-group berghain_challenge challenge if is_challenge_path
http-request return status 501 if { var(txn.berghain.error) -m found }
acl has_token var(txn.berghain.token) -m found
http-after-response add-header set-cookie "berghain=%[var(txn.berghain.token)]; %[var(txn.berghain.domain)] path=/;" if has_token
http-request return status 200 content-type "application/json" lf-string "%[var(txn.berghain.response)]" if is_challenge_path
http-request return status 404
backend berghain_spop
mode tcp
option spop-check
server localhost 127.0.0.1:19091 check