Christopher Faulet | c5a0aee | 2020-02-05 16:46:38 +0100 | [diff] [blame] | 1 | varnishtest "Test the HTTP return action with errorfiles" |
| 2 | #REQUIRE_VERSION=2.2 |
| 3 | |
| 4 | # This config tests the HTTP return action when error files are used to reply to |
| 5 | # the client. |
| 6 | |
| 7 | feature ignore_unknown_macro |
| 8 | |
| 9 | haproxy h1 -conf { |
| 10 | http-errors errors-2 |
| 11 | errorfile 400 ${testdir}/errors/400-2.http |
| 12 | |
| 13 | defaults |
| 14 | mode http |
| 15 | timeout connect 1s |
| 16 | timeout client 1s |
| 17 | timeout server 1s |
| 18 | |
| 19 | frontend fe1 |
| 20 | bind "fd@${fe1}" |
| 21 | errorfile 400 ${testdir}/errors/400.http |
| 22 | http-request return status 400 default-errorfiles if { path /def } |
| 23 | http-request return status 400 errorfile ${testdir}/errors/400-1.http if { path /400-1 } |
| 24 | http-request return status 400 errorfiles errors-2 if { path /400-2 } |
| 25 | } -start |
| 26 | |
| 27 | client c1 -connect ${h1_fe1_sock} { |
| 28 | txreq -req GET -url /def |
| 29 | rxresp |
| 30 | expect resp.status == 400 |
| 31 | expect resp.http.x-err-type == "default" |
| 32 | } -run |
| 33 | |
| 34 | client c1r2 -connect ${h1_fe1_sock} { |
| 35 | txreq -req GET -url /400-1 |
| 36 | rxresp |
| 37 | expect resp.status == 400 |
| 38 | expect resp.http.x-err-type == "errors-1" |
| 39 | } -run |
| 40 | |
| 41 | client c1r3 -connect ${h1_fe1_sock} { |
| 42 | txreq -req GET -url /400-2 |
| 43 | rxresp |
| 44 | expect resp.status == 400 |
| 45 | expect resp.http.x-err-type == "errors-2" |
| 46 | } -run |