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 "Goto and fallbacks" | |
server s1 { | |
rxreq | |
txresp | |
expect req.url == "/probe" | |
accept | |
rxreq | |
txresp |
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
# | |
# AWS Secrets Manager v1.0 | |
# | |
import crypto; | |
import http; | |
import json; | |
import kvstore; | |
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 "Use xbody to generate an Etag" | |
server s1 { | |
rxreq | |
txresp -body "This is a test" | |
} -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
# | |
# JWT - Remote JWK API | |
# | |
vcl 4.1; | |
import edgestash; | |
import goto; | |
import http; | |
import json; |
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 "VTC with v1 routing to itself" | |
# Start v1 with no VCL so we can get a addr and port | |
server s1 {} -start | |
varnish v1 -vcl+backend {} -start | |
varnish v1 -vcl+backend { | |
backend self | |
{ | |
.host = "${v1_addr}"; |
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 HTTP Post timeout" | |
server s1 -repeat 3 { | |
rxreq | |
txresp | |
expect req.body == "postdata is here" | |
} -start | |
varnish v1 -arg "-p timeout_idle=3.0" -vcl+backend { | |
sub vcl_recv { |
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 urlplus; | |
import xbody; | |
sub vcl_backend_response { | |
# Insert the JSONP callback | |
if (urlplus.query_get("callback") && beresp.http.Content-Type ~ "json") { | |
xbody.regsub("^", urlplus.query_get("callback") + "("); | |
xbody.regsub("$", ");"); | |
set beresp.http.Content-Type = regsub(beresp.http.Content-Type, "json", "javascript"); | |
} |
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 "JSONP support" | |
server s1 -repeat 2 { | |
rxreq | |
txresp -hdr "Content-Type: application/json" -body {"json"} | |
} -start | |
varnish v1 -vcl+backend { | |
import urlplus; | |
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
varnishtest "Validate JSON, if invalid, refetch" | |
server s1 { | |
rxreq | |
txresp -hdr "Content-Type: application/json" -body { | |
{ | |
"some": "field", | |
"error...bad json | |
} | |
} |
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
# Shard reconfiguration accuracy | |
# Create two different shard configurations, s1 and s2 | |
# See what percentage of URLs map the same (200) vs different (500) | |
vcl 4.0; | |
import crypto; | |
import directors; | |
backend b01 { .host = "0"; } |