emptygif
భాష: తెలుగు

అన్ని భాషలు, ఫ్రేమ్‌వర్క్‌లు

Varnish (VCL synthetic) VCL

/pixel.gif కు వచ్చే రిక్వెస్ట్‌లకు empty GIF తో జవాబిచ్చే, Varnish (VCL synthetic) కోసం VCL స్నిపెట్. GIF స్టార్టప్‌లో ఒక్కసారే డీకోడ్ అవుతుంది.

Varnish (VCL synthetic) VCL

ఫైల్
default.vcl
రన్
varnishd -f /etc/varnish/default.vcl -a :8080
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);
    }
}

మేము ఈ స్నిపెట్‌ను రన్ చేసి, అది తిరిగి ఇచ్చిన బైట్‌లను పోల్చి చూశాం.

చెక్ చేయండి

curl -sI http://localhost:8080/pixel.gif

అధికారిక సైట్: Varnish (VCL synthetic)