Skip to content

Commit d2a7e10

Browse files
authored
Merge pull request #63 from elgentos/check_stripped_headers
#17 check stripped headers
2 parents 8dbb369 + 995f536 commit d2a7e10

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
varnishtest "Don't show stripped headers"
2+
3+
server s1 {
4+
# first request will be the probe, handle it and be on our way
5+
rxreq
6+
expect req.url == "/health_check.php"
7+
txresp
8+
9+
# the probe expects the connection to close
10+
close
11+
accept
12+
13+
rxreq
14+
expect req.url == "/"
15+
expect req.method == "GET"
16+
txresp -hdr "X-Magento-Debug: 1" \
17+
-hdr "X-Magento-Tags: tag1" \
18+
-hdr "X-Powered-By: PHP" \
19+
-hdr "Server: Apache" \
20+
-hdr "X-Varnish: 12345" \
21+
-hdr "Via: 1.1 varnish" \
22+
-hdr "Link: </style.css>; rel=preload" \
23+
-hdr "XKey: somekey" \
24+
-hdr "Expires: Thu, 01 Dec 2024 16:00:00 GMT" \
25+
-hdr "Pragma: no-cache"
26+
} -start
27+
28+
# Generate the VCL file based on included variables and write it to output.vcl
29+
shell {
30+
export s1_addr="${s1_addr}"
31+
export s1_port="${s1_port}"
32+
${testdir}/helpers/parse_vcl.pl "${testdir}/../../etc/varnish6.vcl" "${tmpdir}/output.vcl"
33+
}
34+
35+
varnish v1 -arg "-f" -arg "${tmpdir}/output.vcl" -arg "-p" -arg "vsl_mask=+Hash" -start
36+
37+
# make sure the probe request fired
38+
delay 1
39+
40+
client c1 {
41+
txreq -method "GET" -url "/"
42+
rxresp
43+
expect resp.http.Expires == <undef>
44+
expect resp.http.Pragma == <undef>
45+
expect resp.http.X-Magento-Debug == <undef>
46+
expect resp.http.X-Magento-Tags == <undef>
47+
expect resp.http.X-Powered-By == <undef>
48+
expect resp.http.Server == <undef>
49+
expect resp.http.X-Varnish == <undef>
50+
expect resp.http.Via == <undef>
51+
expect resp.http.Link == <undef>
52+
expect resp.http.XKey == <undef>
53+
} -run

0 commit comments

Comments
 (0)