blob: b6c8ccb494b5e750425c89875e0409d677ee4a1a [file] [log] [blame]
Christopher Faulet6072beb2020-02-18 15:34:58 +01001varnishtest "Test the HTTP directive monitor-uri"
2#REQUIRE_VERSION=2.2
3
4# This config tests the HTTP directive monitor-uri. Especially the path matching
5# when an absolute-form uri is received from the client. But also the
6# case-sensitivity of the matching.
7
8feature ignore_unknown_macro
9
10haproxy h1 -conf {
11 defaults
12 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010013 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
14 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
15 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Christopher Faulet6072beb2020-02-18 15:34:58 +010016
17 frontend fe1
18 bind "fd@${fe1}"
19 monitor-uri /health
20
21 frontend fe2
22 bind "fd@${fe2}"
23 monitor-uri http://www.haproxy.org/health
24} -start
25
26client c1 -connect ${h1_fe1_sock} {
27 txreq -req GET -url /health
28 rxresp
29 expect resp.status == 200
30} -run
31
32client c2 -connect ${h1_fe1_sock} {
33 txreq -req GET -url http://www.haproxy.org/health \
34 -hdr "Host: www.haproxy.org"
35 rxresp
36 expect resp.status == 200
37} -run
38
39client c3 -connect ${h1_fe1_sock} {
40 txreq -req GET -url /hEAlth
41 rxresp
42 expect resp.status == 503
43} -run
44
45client c4 -connect ${h1_fe2_sock} {
46 txreq -req GET -url http://www.haproxy.org/health \
47 -hdr "Host: www.haproxy.org"
48 rxresp
49 expect resp.status == 200
50} -run
51
52client c5 -connect ${h1_fe2_sock} {
53 txreq -req GET -url /health
54 rxresp
55 expect resp.status == 503
56} -run