Christopher Faulet | 26e1841 | 2020-06-11 13:43:20 +0200 | [diff] [blame] | 1 | varnishtest "Test the errofile directive in proxy sections" |
| 2 | |
| 3 | # This config tests the errorfile directive in proxy sections (including the |
| 4 | # defaults section). |
| 5 | |
| 6 | feature ignore_unknown_macro |
| 7 | |
| 8 | |
| 9 | haproxy h1 -conf { |
| 10 | defaults |
| 11 | mode http |
| 12 | timeout connect 1s |
| 13 | timeout client 1s |
| 14 | timeout server 1s |
| 15 | 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 | |
| 32 | client 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 |
| 38 | client 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 |
| 44 | client c1r3 -connect ${h1_fe1_sock} { |
| 45 | txreq -req GET -url /408 |
| 46 | expect_close |
| 47 | } -run |
| 48 | client c1r4 -connect ${h1_fe1_sock} { |
| 49 | txreq -req GET -url /500 |
| 50 | expect_close |
| 51 | } -run |