Christopher Faulet | 6072beb | 2020-02-18 15:34:58 +0100 | [diff] [blame] | 1 | varnishtest "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 | |
| 8 | feature ignore_unknown_macro |
| 9 | |
| 10 | haproxy h1 -conf { |
| 11 | defaults |
| 12 | mode http |
| 13 | timeout connect 1s |
| 14 | timeout client 1s |
| 15 | timeout server 1s |
| 16 | |
| 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 | |
| 26 | client c1 -connect ${h1_fe1_sock} { |
| 27 | txreq -req GET -url /health |
| 28 | rxresp |
| 29 | expect resp.status == 200 |
| 30 | } -run |
| 31 | |
| 32 | client 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 | |
| 39 | client c3 -connect ${h1_fe1_sock} { |
| 40 | txreq -req GET -url /hEAlth |
| 41 | rxresp |
| 42 | expect resp.status == 503 |
| 43 | } -run |
| 44 | |
| 45 | client 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 | |
| 52 | client c5 -connect ${h1_fe2_sock} { |
| 53 | txreq -req GET -url /health |
| 54 | rxresp |
| 55 | expect resp.status == 503 |
| 56 | } -run |