blob: 4dddfe772bd975dcd23f9fe2ee175c737033af5b [file] [log] [blame]
Willy Tarreau19490902020-09-23 09:02:13 +02001vtest "Test for balance URI"
2feature ignore_unknown_macro
3#REQUIRE_VERSION=2.0
4
5server s1 {
6 rxreq
7 txresp -hdr "Server: s1"
8} -repeat 2 -start
9
10server s2 {
11 rxreq
12 txresp -hdr "Server: s2"
13} -repeat 2 -start
14
15server s3 {
16 rxreq
17 txresp -hdr "Server: s3"
18} -repeat 2 -start
19
20server s4 {
21 rxreq
22 txresp -hdr "Server: s4"
23} -repeat 2 -start
24
25haproxy h1 -arg "-L A" -conf {
26 defaults
27 mode http
28 timeout server 1s
29 timeout connect 1s
30 timeout client 1s
31
32 listen px
33 bind "fd@${px}"
34 balance uri
35 server srv1 ${s1_addr}:${s1_port}
36 server srv2 ${s2_addr}:${s2_port}
37 server srv3 ${s3_addr}:${s3_port}
38 server srv4 ${s4_addr}:${s4_port}
39} -start
40
41client c1 -connect ${h1_px_sock} {
42 txreq -url "/url1"
43 rxresp
44 expect resp.status == 200
45 expect resp.http.Server ~ s2
46} -run
47
48client c2 -connect ${h1_px_sock} {
49 txreq -url "/url1?ignore=this-arg"
50 rxresp
51 expect resp.status == 200
52 expect resp.http.Server ~ s2
53} -run
54
55client c3 -connect ${h1_px_sock} {
56 txreq -url "/url2"
57 rxresp
58 expect resp.status == 200
59 expect resp.http.Server ~ s3
60} -run
61
62client c4 -connect ${h1_px_sock} {
63 txreq -url "/url3"
64 rxresp
65 expect resp.status == 200
66 expect resp.http.Server ~ s4
67} -run
68
69client c5 -connect ${h1_px_sock} {
70 txreq -url "/url4"
71 rxresp
72 expect resp.status == 200
73 expect resp.http.Server ~ s1
74} -run