blob: 826a336cbea9463a826f87eb70a95114c2c66953 [file] [log] [blame]
Christopher Faulete41b4972021-10-13 18:06:55 +02001varnishtest "Test declaration of TCP rules in default sections"
2
3#REQUIRE_VERSION=2.5
4
5feature ignore_unknown_macro
6
7server s1 {
8 rxreq
9 txresp
10 expect req.http.x-test1-frt == "def_front"
11 expect req.http.x-test1-bck == "def_back"
12} -start
13
14haproxy h1 -conf {
15 defaults common
16 mode http
17 timeout connect 1s
18 timeout client 1s
19 timeout server 1s
20
21 defaults def_front from common
22 tcp-request connection accept
23 tcp-request session accept
24 tcp-request inspect-delay 5s
25 tcp-request content set-var(txn.test1) "str(def_front)"
26 tcp-request content accept
27
28 defaults def_back from common
29 tcp-request inspect-delay 5s
30 tcp-request content set-var(txn.test1) "str(def_back)"
31 tcp-request content accept
32
33 tcp-response inspect-delay 5s
34 tcp-response content set-var(txn.test2) "str(def_back)"
35 tcp-response content accept
36
37 frontend fe from def_front
38 bind "fd@${feh1}"
39 tcp-request connection reject
40 tcp-request session reject
41 tcp-request content reject
42
43 http-request set-header x-test1-frt "%[var(txn.test1)]"
44
45 default_backend be
46
47 backend be from def_back
48 tcp-response content reject
49
50 http-request set-header x-test1-bck "%[var(txn.test1)]"
51 http-response set-header x-test2 "%[var(txn.test2)]"
52
53 server s1 ${s1_addr}:${s1_port}
54
55} -start
56
57client c1 -connect ${h1_feh1_sock} {
58 txreq -req GET -url /
59 rxresp
60 expect resp.status == 200
61 expect resp.http.x-test2 == "def_back"
62} -run