blob: ab2df33b6225b67f9ba6b211e497a0981d235091 [file] [log] [blame]
Tim Duesterhus5fcec842020-02-28 15:13:32 +01001varnishtest "unique-id test"
2
Willy Tarreau5e8017d2020-04-01 16:08:43 +02003#REQUIRE_VERSION=2.0
4
Tim Duesterhus5fcec842020-02-28 15:13:32 +01005feature ignore_unknown_macro
6
7server s1 {
8 rxreq
9 txresp
10} -repeat 2 -start
11
12haproxy h1 -conf {
13 defaults
14 mode http
15 timeout connect 1s
16 timeout client 1s
17 timeout server 1s
18
19 frontend stable
20 bind "fd@${fe1}"
21 unique-id-format TEST-%[uuid]
22 http-response set-header A %[unique-id]
23 http-response set-header B %[unique-id]
24 default_backend be
25
26 frontend request_data
27 bind "fd@${fe2}"
28 unique-id-format TEST-%[req.hdr(in)]
29 http-response set-header out %[unique-id]
30 default_backend be
31
32 backend be
33 server srv1 ${s1_addr}:${s1_port}
34} -start
35
36client c1 -connect ${h1_fe1_sock} {
37 txreq -url "/"
38 rxresp
39 expect resp.status == 200
40 expect resp.http.a == resp.http.b
41} -run
42
43client c2 -connect ${h1_fe2_sock} {
44 txreq -url "/" \
45 -hdr "in: 12345678"
46 rxresp
47 expect resp.status == 200
48 expect resp.http.out == "TEST-12345678"
49} -run