blob: 3fb9e7a20cf2add46d266d36c7b657299a8041b1 [file] [log] [blame]
Amaury Denoyellea47dfab2021-03-02 14:39:20 +01001varnishtest "Test the proper interaction between http-reuse and backend in transparent mode"
Aurelien DARRAGONda81bc32023-11-23 09:23:30 +01002feature cmd "$HAPROXY_PROGRAM -cc 'feature(TPROXY)'"
Amaury Denoyellea47dfab2021-03-02 14:39:20 +01003
4# If backend is used with the transparent mode, the connection are considered
5# as private and should only be reused for requests of the same session.
6# This is similar to the http-reuse never mode
7
8#REQUIRE_VERSION=2.4
9
10feature ignore_unknown_macro
11
12haproxy h1 -conf {
13 defaults
14 mode http
15
16 listen sender
17 bind "fd@${feS}"
18 http-request set-header client-id %[req.hdr(client-id)] if { req.hdr(client-id) -m found }
19 option transparent
20 http-request set-dst-port int(${h1_feR_port})
21
22 listen receiver
23 bind "fd@${feR}"
24 http-request set-var(sess.client_id) req.hdr(client-id)
25 http-request return status 200
26 http-after-response set-header http_first_request %[http_first_req]
27 http-after-response set-header client-id %[var(sess.client_id)]
28} -start
29
30client c1 -connect ${h1_feS_sock} {
31 txreq \
32 -hdr "client-id: c1"
33 rxresp
34 expect resp.http.http_first_request == "1"
35
36 txreq
37 rxresp
38 expect resp.http.http_first_request == "0"
39 expect resp.http.client-id == "c1"
40
41 txreq
42 rxresp
43 expect resp.http.http_first_request == "0"
44 expect resp.http.client-id == "c1"
45} -run
46
47client c2 -connect ${h1_feS_sock} {
48 txreq \
49 -hdr "client-id: c2"
50 rxresp
51 expect resp.http.http_first_request == "1"
52 expect resp.http.client-id == "c2"
53
54 txreq
55 rxresp
56 expect resp.http.http_first_request == "0"
57 expect resp.http.client-id == "c2"
58
59 txreq
60 rxresp
61 expect resp.http.http_first_request == "0"
62 expect resp.http.client-id == "c2"
63} -run
64
65client c3 -connect ${h1_feS_sock} {
66 txreq \
67 -hdr "client-id: c3"
68 rxresp
69 expect resp.http.http_first_request == "1"
70 expect resp.http.client-id == "c3"
71
72 txreq
73 rxresp
74 expect resp.http.http_first_request == "0"
75 expect resp.http.client-id == "c3"
76
77 txreq
78 rxresp
79 expect resp.http.http_first_request == "0"
80 expect resp.http.client-id == "c3"
81} -run
82