This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VCP layer: | |
v_b_r: | |
# Simply use caching headers. Nothing relevant here. | |
if beresp.http.X-VCP-Ttl > 0: | |
beresp.ttl = beresp.http.X-VCP-Ttl | |
beresp.grace = beresp.http.X-VCP-Grace | |
beresp.keep = beresp.http.X-VCP-Keep | |
else: | |
# Let built-in VCL transform this in a HFM. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest "implementing x-accel-redirect" | |
server s1 { | |
rxreq | |
expect req.url == "/s1" | |
txresp -hdr "X-Accel-Redirect: /s2" | |
rxreq | |
expect req.url == "/s2" | |
txresp | |
} -start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std; | |
sub vcl_recv { | |
if (!std.healthy(req.backend_hint)) { | |
set req.grace = 4h; | |
} | |
sub vcl_backend_response { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest "Cut off ESI request should be retried" | |
server s1 { | |
rxreq | |
expect req.url == "/list" | |
txresp -body {<esi:include src="/fragment"/>} | |
rxreq | |
expect req.url == "/fragment" | |
txresp -status 503 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub vcl_recv { | |
if (req.http.host == "t1.weiyuzw.com") { | |
set req.backend_hint = origin_t1_weiyuzw; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
import http; | |
# We define the origin servers | |
# assumption they listen on port 80, please change it if not true | |
backend origin_a { | |
.host = "103.234.96.112"; | |
.port = "80"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest "hash director with sick backend" | |
server s1 -repeat 2 { | |
rxreq | |
expect req.url == "/s1" | |
expect req.http.Host == "host2" | |
txresp -hdr "Server: s1" -body "server1" | |
} -start | |
server s2 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest ESI | |
server s1 { | |
rxreq | |
txresp -body { | |
<html> | |
Before include | |
<!--esi <esi:include src=""/> --> | |
After include | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.1; | |
import cookieplus; | |
import header; | |
import std; | |
import directors; | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "8081"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server s1 { # Part 1 requests | |
rxreq | |
txresp -body "1" | |
expect req.url == "/1" | |
rxreq | |
txresp -body "2" | |
expect req.url == "/1" | |
# Part 2 requests | |
rxreq |