blob: 1ace744fad8f3b9a121138c3892c038a64fa1497 [file] [log] [blame]
Christopher Faulet60837d32020-06-11 13:43:20 +02001varnishtest "Test the errofile directive in proxy sections"
2
3# This config tests the errorfile directive in proxy sections (including the
4# defaults section).
5
6feature ignore_unknown_macro
7
8
9haproxy h1 -conf {
10 defaults
11 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010012 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
13 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
14 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Christopher Faulet60837d32020-06-11 13:43:20 +020015 errorfile 400 ${testdir}/errors/400.http
16 errorfile 403 ${testdir}/errors/403.http
17 errorfile 408 /dev/null
18
19 frontend fe1
20 bind "fd@${fe1}"
21
22 errorfile 403 ${testdir}/errors/403-1.http
23 errorfile 500 /dev/null
24
25 http-request deny deny_status 400 if { path /400 }
26 http-request deny deny_status 403 if { path /403 }
27 http-request deny deny_status 408 if { path /408 }
28 http-request deny deny_status 500 if { path /500 }
29
30} -start
31
32client c1r1 -connect ${h1_fe1_sock} {
33 txreq -req GET -url /400
34 rxresp
35 expect resp.status == 400
36 expect resp.http.x-err-type == "default"
37} -run
38client c1r2 -connect ${h1_fe1_sock} {
39 txreq -req GET -url /403
40 rxresp
41 expect resp.status == 403
42 expect resp.http.x-err-type == "errors-1"
43} -run
44client c1r3 -connect ${h1_fe1_sock} {
45 txreq -req GET -url /408
46 expect_close
47} -run
48client c1r4 -connect ${h1_fe1_sock} {
49 txreq -req GET -url /500
50 expect_close
51} -run