blob: c1f0fc480dc3a94222689ad2df9e468b3b7e8beb [file] [log] [blame]
Tim Duesterhuscf6e0c82020-03-13 12:34:24 +01001varnishtest "Check that the unique ID TLV is properly sent"
2
3#REQUIRE_VERSION=2.2
4
5feature ignore_unknown_macro
6
7haproxy h1 -conf {
8 defaults
9 mode http
10 log global
11 unique-id-format %{+X}o\ TEST-%[req.hdr(in)]
12
13 listen sender
14 bind "fd@${feS}"
15
16 unique-id-header unique_id
17
18 server example ${h1_feR_addr}:${h1_feR_port} send-proxy-v2 proxy-v2-options unique-id
19
20 listen receiver
21 bind "fd@${feR}" accept-proxy
22
23 http-request set-var(txn.http_unique_id) req.hdr(unique_id)
24 http-request set-var(txn.proxy_unique_id) fc_pp_unique_id
25 http-after-response set-header http_unique_id %[var(txn.http_unique_id)]
26 http-after-response set-header proxy_unique_id %[var(txn.proxy_unique_id)]
27 http-request return status 200
28} -start
29
30# Validate that a correct header passes
31client c1 -connect ${h1_feS_sock} {
32 txreq -url "/" \
33 -hdr "in: foo"
34 rxresp
35 expect resp.http.http_unique_id == "TEST-foo"
36 expect resp.http.proxy_unique_id == "TEST-foo"
37 txreq -url "/" \
38 -hdr "in: bar"
39 rxresp
40 expect resp.http.http_unique_id == "TEST-bar"
41 expect resp.http.proxy_unique_id == "TEST-foo"
42} -run