Exclude Domain from Varnish: Unterschied zwischen den Versionen
Erscheinungsbild
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.…“ |
Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
<syntaxhighlight lang=" | sudo nano /etc/varnish/default.vcl | ||
<syntaxhighlight lang="per"> | |||
sub vcl_recv { | sub vcl_recv { | ||
# Don't cache domain1.com or domain2.org - optional www | # Don't cache domain1.com or domain2.org - optional www | ||
| Zeile 6: | Zeile 8: | ||
} | } | ||
} | } | ||
sub vcl_deliver { | 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 | # 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 | ||
| Zeile 16: | Zeile 17: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
sudo service varnish restart | |||
Version vom 29. September 2015, 15:13 Uhr
sudo nano /etc/varnish/default.vcl
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";
}
}sudo service varnish restart