Last active
July 6, 2016 00:41
-
-
Save rezan/ad5642ce12125eb553904c94c620b480 to your computer and use it in GitHub Desktop.
Cedexis test objects local in Varnish Cache
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
/* | |
* Cedexis test object location: L34, L39 | |
* | |
* Requires vmod null: | |
* https://github.com/varnish/libvmod-null | |
* | |
*/ | |
vcl 4.0; | |
import std; | |
import null; | |
backend default | |
{ | |
.host = "0.0.0.0"; | |
.port = "80"; | |
} | |
sub vcl_recv | |
{ | |
if (req.url == "/cedexis/r20.gif") { | |
return (synth(781)); | |
} else if (req.url == "/cedexis/r20-100KB.png") { | |
return (synth(782)); | |
} | |
} | |
sub vcl_synth | |
{ | |
if (resp.status == 781) { | |
set resp.status = 200; | |
set resp.http.Content-Type = "image/gif"; | |
null.synth(std.fileread("/some/path/r20.gif"), 43); | |
return (deliver); | |
} else if (resp.status == 782) { | |
set resp.status = 200; | |
set resp.http.Content-Type = "image/png"; | |
null.synth(std.fileread("/some/path/r20-100KB.png"), 102400); | |
return (deliver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment