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
# Purge multiple urls from a request body | |
import edgestash; | |
import synthbackend; | |
import xbody; | |
sub vcl_recv { | |
unset req.http.purgelist; | |
if (req_top.method == "PURGELIST") { | |
if (req.esi_level == 0) { |
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 "Multipurging" | |
server s1 { | |
} -start | |
varnish v1 -vcl+backend { | |
import edgestash; | |
import synthbackend; | |
import xbody; |
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
BEFORE | |
[reza@77-40-251-104 ovc60]$ bin/varnishlog -g request -d -q "ReqHeader:hls-segment eq 1568214974" | grep Waiting | |
- Timestamp Waitinglist: 1568214974.765237 0.126271 0.126271 | |
- Timestamp Waitinglist: 1568214974.765223 0.126131 0.126131 | |
- Timestamp Waitinglist: 1568214974.765225 0.126174 0.126174 | |
- Timestamp Waitinglist: 1568214975.642919 1.002913 1.002913 | |
- Timestamp Waitinglist: 1568214975.642900 1.003035 1.003035 | |
- Timestamp Waitinglist: 1568214975.642918 1.002753 1.002753 | |
- Timestamp Waitinglist: 1568214975.642931 1.002935 1.002935 |
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
# | |
# Stale-If-Error (v1.0) | |
# | |
import std; | |
sub vcl_recv { | |
# First pass, clear SIE headers | |
if (!req.restarts) { | |
unset req.http.x-sie6-enabled; |
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 "Transform ESI to Edgestash using XBody" | |
server s1 { | |
rxreq | |
txresp -body { | |
Start <esi:remove> | |
... | |
</esi:remove> | |
<!--esi <esi:include src="/somewhere" /> --> |
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
# | |
# S3 v4 request signing (v1.6) | |
# | |
import crypto; | |
import goto; | |
import kvstore; | |
import std; | |
import urlplus; | |
import utils; |
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 "Test xbody hash large body" | |
server s1 { | |
rxreq | |
txresp -bodylen 500000 | |
} -start | |
varnish v1 -vcl+backend { | |
import crypto; | |
import xbody; |
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
# Live prefetching | |
vcl 4.1; | |
import http; | |
import kvstore; | |
sub vcl_init | |
{ | |
new limit = kvstore.init(); |
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
# Backend prefetch | |
vcl 4.1; | |
import http; | |
sub vcl_recv { | |
// Generate the prefetch URL | |
set req.http.X-prefetch = http.prefetch_next_url(prefix = "/.*/dash/[0-9]+-[0-9]+/"); | |
} |