Skip to content

Instantly share code, notes, and snippets.

@rezan
Created September 22, 2016 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rezan/b8c3b69a4b7d72b936c151609bad20ec to your computer and use it in GitHub Desktop.
Save rezan/b8c3b69a4b7d72b936c151609bad20ec to your computer and use it in GitHub Desktop.
Edgestash VCL generated JSON variables
vcl 4.0;
# Edgestash
# VCL generated JSON variables
#
# /edgestash/test/1 template contents:
# Hello {{name}} {{test}}!
backend default
{
.host = "localhost";
.port = "80";
}
include "hit_miss.vcl";
sub vcl_recv
{
if (req.url == "/synth/json") {
return(synth(800));
}
}
sub vcl_backend_response
{
if (bereq.url == "/edgestash/test/1") {
set beresp.do_edgestash = true;
}
}
sub vcl_synth
{
if (resp.status == 800) {
synthetic({"
{
"name":"Reza",
"test":""} + req.http.test + {""
}
"});
return (deliver);
}
}
sub vcl_deliver
{
set resp.http.X-Test = "Varnish Plus 4.1 EDGESTASH JSON VCL";
if (req.url == "/edgestash/test/1") {
set resp.edgestash_json = "/synth/json";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment