blob: 1a66114d4b513ca878b165c2fae69eb5c5741f28 [file] [log] [blame]
Willy Tarreau19490902020-09-23 09:02:13 +02001vtest "Test for balance URI"
2feature ignore_unknown_macro
3#REQUIRE_VERSION=2.3
4
5server s1 {
6 rxreq
7 txresp -hdr "Server: s1" -body "s1"
8} -repeat 5 -start
9
10server s2 {
11 rxreq
12 txresp -hdr "Server: s2" -body "s2"
13} -repeat 5 -start
14
15server s3 {
16 rxreq
17 txresp -hdr "Server: s3" -body "s3"
18} -repeat 5 -start
19
20server s4 {
21 rxreq
22 txresp -hdr "Server: s4" -body "s4"
23} -repeat 5 -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 bind "fd@${pxh2}" proto h2
35 balance uri path-only
36 server srv1 ${s1_addr}:${s1_port}
37 server srv2 ${s2_addr}:${s2_port}
38 server srv3 ${s3_addr}:${s3_port}
39 server srv4 ${s4_addr}:${s4_port}
40} -start
41
42client c1 -connect ${h1_px_sock} {
Willy Tarreau2aa3dd22020-09-29 09:58:23 +020043 txreq -url "http://127.0.0.1/url1"
Willy Tarreau19490902020-09-23 09:02:13 +020044 rxresp
45 expect resp.status == 200
46 expect resp.http.Server ~ s2
47} -run
48
49client c2 -connect ${h1_px_sock} {
50 txreq -url "/url1?ignore=this-arg"
51 rxresp
52 expect resp.status == 200
53 expect resp.http.Server ~ s2
54} -run
55
56client c3 -connect ${h1_px_sock} {
Willy Tarreau2aa3dd22020-09-29 09:58:23 +020057 txreq -url "http://127.0.0.1/url2"
Willy Tarreau19490902020-09-23 09:02:13 +020058 rxresp
59 expect resp.status == 200
60 expect resp.http.Server ~ s3
61} -run
62
63client c4 -connect ${h1_px_sock} {
64 txreq -url "/url3"
65 rxresp
66 expect resp.status == 200
67 expect resp.http.Server ~ s4
68} -run
69
70client c5 -connect ${h1_px_sock} {
71 txreq -url "/url4"
72 rxresp
73 expect resp.status == 200
74 expect resp.http.Server ~ s1
75} -run
76
77client c6h2 -connect ${h1_pxh2_sock} {
78 txpri
79 stream 0 {
80 txsettings
81 rxsettings
82 txsettings -ack
83 rxsettings
84 expect settings.ack == true
85 } -run
86
87 stream 1 {
88 txreq \
89 -req "GET" \
90 -scheme "https" \
91 -url "/url1"
92 rxhdrs
93 expect resp.status == 200
94 rxdata -all
95 expect resp.body == "s2"
96 } -run
97} -run