blob: 53c4c42aa8b5b0ea28acb391653d5ce9b9aa5207 [file] [log] [blame]
Christopher Fauleta5afb0b2020-01-20 13:49:48 +01001varnishtest "Test the custom erorrs for HTTP deny rules"
2#REQUIRE_VERSION=2.2
3
4# This config tests the custom errors for HTTP deny rules.
5
6feature ignore_unknown_macro
7
8
9haproxy h1 -conf {
10 http-errors errors-1
11 errorfile 400 ${testdir}/errors/400-1.http
12 errorfile 403 ${testdir}/errors/403-1.http
13 errorfile 404 ${testdir}/errors/404-1.http
14 errorfile 500 /dev/null
15
16 defaults
17 mode http
18 timeout connect 1s
19 timeout client 1s
20 timeout server 1s
21
22 frontend fe1
23 bind "fd@${fe1}"
24 http-request deny deny_status 400 if { path /400 }
25 http-request deny deny_status 403 errorfile ${testdir}/errors/403.http if { path /403 }
26 http-request deny deny_status 404 errorfiles errors-1 if { path /404 }
27 http-request deny deny_status 500 errorfile /dev/null if { path /500-1 }
28 http-request deny deny_status 500 errorfiles errors-1 if { path /500-2 }
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 == <undef>
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 == "default"
43} -run
44client c1r3 -connect ${h1_fe1_sock} {
45 txreq -req GET -url /404
46 rxresp
47 expect resp.status == 404
48 expect resp.http.x-err-type == "errors-1"
49} -run
50client c1r4 -connect ${h1_fe1_sock} {
51 txreq -req GET -url /500-1
52 expect_close
53} -run
54client c1r5 -connect ${h1_fe1_sock} {
55 txreq -req GET -url /500-2
56 expect_close
57} -run