Skip to content

Instantly share code, notes, and snippets.

Avatar

guillaume quintard gquintard

View GitHub Profile
View Dockerfile
FROM debian:stretch-slim
RUN apt update && \
echo > /etc/apt/sources.list.d/varnish.list deb https://packagecloud.io/varnishcache/varnish62/debian/ stretch main && \
echo >> /etc/apt/sources.list.d/varnish.list deb-src https://packagecloud.io/varnishcache/varnish62/debian/ stretch main && \
apt-get install devscripts dpkg-dev curl gnupg apt-transport-https -y && \
curl -L https://packagecloud.io/varnishcache/varnish62/gpgkey | apt-key add - && \
apt update && \
mkdir /tmp/workdir && \
cd /tmp/workdir && \
View Dockerfile
FROM debian:stretch-slim
RUN apt update && \
echo > /etc/apt/sources.list.d/varnish.list deb https://packagecloud.io/varnishcache/varnish62/debian/ stretch main && \
echo >> /etc/apt/sources.list.d/varnish.list deb-src https://packagecloud.io/varnishcache/varnish62/debian/ stretch main && \
apt-get install devscripts dpkg-dev curl gnupg apt-transport-https -y && \
curl -L https://packagecloud.io/varnishcache/varnish62/gpgkey | apt-key add - && \
apt update && \
mkdir /tmp/workdir && \
cd /tmp/workdir && \
View gist:18b4ad4e1dd078a889ecb9e90aa0f0d3
FROM debian:stretch-slim
RUN apt update && \
echo > /etc/apt/sources.list.d/varnish.list deb https://packagecloud.io/varnishcache/varnish62/debian/ stretch main && \
echo >> /etc/apt/sources.list.d/varnish.list deb-src https://packagecloud.io/varnishcache/varnish62/debian/ stretch main && \
apt-get install devscripts dpkg-dev curl gnupg apt-transport-https -y && \
curl -L https://packagecloud.io/varnishcache/varnish62/gpgkey | apt-key add - && \
apt update && \
mkdir /tmp/workdir && \
cd /tmp/workdir && \
View gist:58ed35d2d2cd67a2e10d95a9baac4ae6
vcl 4.0; /* don't mind that, that's the vcl version, not the varnish version*/
import std;
backend api {
.host = "192.168.1.123";
}
backend api_limited {
.host = "192.168.1.123";
View foo.yaml
version: '2'
services:
varnish:
image: "varnish-img"
hitch:
image: "hitch-img"
ports:
- "1443:443"
View token_checker.sh
#!/bin/bash
# usage: token_checker.sh KEY [STRING....]
key="$1"
shift
s=
for i in "$@"; do
s="$s$i"
done
@gquintard
gquintard / foo.vtc
Created Mar 17, 2017
Test XFF ip extraction
View foo.vtc
varnishtest "XFF test"
server s1 {} -start
varnish v1 -vcl+backend {
sub vcl_recv {
return (synth(200));
}
@gquintard
gquintard / sticky.vtc
Created Mar 10, 2017
Varnish sticky session (new)
View sticky.vtc
varnishtest "Test cookie vmod"
server s1 {
rxreq
txresp -hdr "server: s1" -hdr "set-cookie: id=123;"
rxreq
txresp -hdr "server: s1"
rxreq
View gist:e11ff0e44c3fbd3530540385ee045ae4
varnishtest "Test cookie vmod"
server s1 {
rxreq
txresp -hdr "set-cookie: id=123;"
rxreq
expect req.http.cookie == "id=123;"
txresp -hdr "server: s1"
View Sysreval.vtc
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"
You can’t perform that action at this time.