Created
September 22, 2016 16:32
-
-
Save rezan/b8c3b69a4b7d72b936c151609bad20ec to your computer and use it in GitHub Desktop.
Edgestash VCL generated JSON variables
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
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