Skip to content

Instantly share code, notes, and snippets.

@rezan
rezan / cvmfs.vcl
Last active February 22, 2024 14:01
Varnish VCL for CVMFS (CernVM-FS)
#
# CVMFS VCL (v1.3)
#
# Tested with CVMFS 2.11 and Varnish Cache 6/7
#
vcl 4.1;
backend cvmfs_origin {
.host = "hostname.org";
@rezan
rezan / no_args.c
Created October 18, 2021 16:51
Valid C program, no errors (-Wall -Wextra -Wpedantic -Werror)
#include <stdio.h>
void test();
int main()
{
printf("no args\n");
test();
return 0;
}
@rezan
rezan / states.vcl
Created March 30, 2021 13:23
VHA6 req.url rewrite hook
#
# VHA6 req.url rewrite hook
#
# File location: /etc/varnish/vha6/hooks/states.vcl
#
import std;
sub vha6_hook_init {
}
@rezan
rezan / miss_302.vcl
Created February 19, 2021 14:30
Varnish VCL - cache misses get an instant 302 response and are fetched in the background
#
# Cache misses get an instant 302 response and are fetched in the background
# (Include this file in your VCL)
#
vcl 4.1;
import std;
import synthbackend;
import vha;
@rezan
rezan / probe_proxy.vcl
Last active December 1, 2020 18:40
Probe Proxy implementation
#
# Probe Proxy v1.0
#
import directors;
import kvstore;
import probe_proxy;
import std;
acl probe_proxy_local {
@rezan
rezan / body_restart.vtc
Created September 21, 2020 16:47
req.body and restarts
varnishtest "req.body and restarts"
server s1 -repeat 4 {
rxreq
txresp -bodylen 1000
} -start
varnish v1 -vcl+backend {
import std;
@rezan
rezan / S00001.vtc
Created July 6, 2020 18:30
varnishscoreboard vcl_recv
varnishtest "varnishscoreboard vcl_recv"
barrier b1 sock 2
barrier b2 sock 2
server s1 {
} -start
varnish v1 -cliok "param.set thread_pool_track on" -vcl+backend {
@rezan
rezan / S00002.vtc
Created July 6, 2020 18:22
varnishscoreboard parallel ESI
varnishtest "varnishscoreboard parallel ESI"
barrier b1 cond 3
barrier b2 cond 3
server s1 {
rxreq
txresp -body {
<esi:include src="/c1"/>
<esi:include src="/c2"/>
@rezan
rezan / client_error.vtc
Created June 18, 2020 19:35
Varnish client download error
varnishtest "varnishncsa logging a client error"
server s1 {
rxreq
txresp -bodylen 10000000
} -start
varnish v1 -vcl+backend {
} -start
@rezan
rezan / goto_fallback.vtc
Created May 7, 2020 13:59
Varnish - goto and fallback
varnishtest "Goto and fallbacks"
server s1 {
rxreq
txresp
expect req.url == "/probe"
accept
rxreq
txresp