Lahat ng language at framework
Varnish (VCL synthetic) VCL
Isang VCL snippet para sa Varnish (VCL synthetic) na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.
Varnish (VCL synthetic) VCL
vcl 4.1;
import blob;
backend default none; # or your real backend
sub vcl_recv {
if (regsub(req.url, "\?.*$", "") == "/pixel.gif") {
return (synth(200, "OK"));
}
}
sub vcl_synth {
if (resp.status == 200 && regsub(req.url, "\?.*$", "") == "/pixel.gif") {
set resp.http.Content-Type = "image/gif";
set resp.http.Cache-Control = "no-store";
set resp.body = blob.decode(BASE64, encoded="R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
return (deliver);
}
}
Pinatakbo namin ang snippet na ito at ikinumpara ang mga byte na ibinalik nito.
Suriin
curl -sI http://localhost:8080/pixel.gif