summaryrefslogtreecommitdiffstats
path: root/reg-tests/http-errorfiles/http_return.vtc
blob: 8db77a9b198fa9d1e56f69b55f06327091bb17ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
varnishtest "Test the HTTP return action with errorfiles"
#REQUIRE_VERSION=2.2

# This config tests the HTTP return action when error files are used to reply to
# the client.

feature ignore_unknown_macro

haproxy h1 -conf {
    http-errors errors-2
        errorfile 400 ${testdir}/errors/400-2.http

    defaults
        mode http
        timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"

    frontend fe1
        bind "fd@${fe1}"
        errorfile 400 ${testdir}/errors/400.http
        http-request return status 400 default-errorfiles if { path /def }
        http-request return status 400 errorfile ${testdir}/errors/400-1.http if { path /400-1 }
        http-request return status 400 errorfiles errors-2 if { path /400-2 }
} -start

client c1  -connect ${h1_fe1_sock} {
        txreq -req GET -url /def
        rxresp
        expect resp.status == 400
	expect resp.http.x-err-type == "default"
} -run

client c1r2  -connect ${h1_fe1_sock} {
        txreq -req GET -url /400-1
        rxresp
        expect resp.status == 400
	expect resp.http.x-err-type == "errors-1"
} -run

client c1r3  -connect ${h1_fe1_sock} {
        txreq -req GET -url /400-2
        rxresp
        expect resp.status == 400
	expect resp.http.x-err-type == "errors-2"
} -run