Zum Inhalt springen

Exclude Domain from Varnish

Aus Computech CMS Wiki
Version vom 29. September 2015, 15:12 Uhr von Simon Zeberli (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „<syntaxhighlight lang="bash"> sub vcl_recv { # Don't cache domain1.com or domain2.org - optional www if (req.http.host ~ "(www\.)?(domain1.com|domain2.…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
sub vcl_recv {
    # Don't cache domain1.com or domain2.org - optional www
    if (req.http.host ~ "(www\.)?(domain1.com|domain2.org)\.(com|nl|org|dev|local)") {
        return (pass);
    }
}

sub vcl_deliver {
    # You can optionally set a reponse header so it's easier for you to debug if Varnish really didn't cache objects for the host

    # Don't cache domain1.com or domain2.org - optional www
    if (req.http.host ~ "(www\.)?(domain1.com|domain2.org)\.(com|nl|org|dev|local)") {
        set resp.http.X-Cache = "EXCLUDED";
    }
}