Skip to content

Instantly share code, notes, and snippets.

varnishtest "Systematic revalidation"
server s1 {
rxreq
txresp -hdr "Etag: 01234" -body "foobar"
expect req.method == "GET"
rxreq
txresp -hdr "Etag: 01234"
expect req.method == "HEAD"
varnishtest "Long vcl/backend names"
server s1 {
rxreq
txresp -status 301 -hdr "Location: http://bar.example.com/bar"
expect req.http.host == "foo.example.com"
expect req.url == "/foo"
rxreq
txresp -status 301 -hdr "Location: http://baz.example.com/baz"
varnishtest "30X redirections"
server s1 {}
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.http.host != "www.varnish-software.com") {
set req.http.location = "https://www.varnish-software.com/";
return(synth(301));
}
@gquintard
gquintard / main.rs
Created December 1, 2016 11:52
sha256 test
extern crate ring;
extern crate time;
use ring::digest::digest;
use ring::digest::SHA256;
fn hash(s: &[u8]) -> Vec<u8> {
let hasher = digest(&SHA256, s);
hasher.as_ref().to_vec()
}
@gquintard
gquintard / vha-explanation.rst
Last active November 28, 2016 19:25
VHA behavior regarding clusters

Version 1

varnishtest "416"
server s1 {
rxreq
send "HTTP/1.1 200 OK\r\n"
send "Content-length: 16\r\n"
send "\r\n"
send "012345678910"
delay 1
send "abcdef"
vcl 4.0;
import std
import directors
backend foo {
.host = "127.0.0.1";
}
backend bar {
@gquintard
gquintard / vcl.json
Last active September 30, 2016 10:13
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Varnish Configuration Object",
"type": "object",
"required": ["backends", "rules"],
"properties": {
"backends": {
"description": "list of origin servers",
"type": "array",
"items": {
<html>
<head>
<title>JQVMap - World Map</title>
<link href="https://raw.githubusercontent.com/manifestinteractive/jqvmap/master/dist/jqvmap.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/manifestinteractive/jqvmap/master/dist/jquery.vmap.js"></script>
<script type="text/javascript" src="https://rawgit.com/manifestinteractive/jqvmap/master/dist/maps/jquery.vmap.world.js" charset="utf-8"></script>
<script type="text/javascript">
var g_reqs = {};
server s1 {
rxreq
expect req.url == "foo"
txresp
} -start
varnish v1 -vcl+backend {
sub vcl_miss {
set req.http.state = "MISS";
}