vcl 4.0; # I used 172.31.27.119 to avoid a 127.0.0.1:80 conflict # between varnishd and the backend (nginx in my case). # I defined only one backend since all my nginx vhosts # are running on 172.31.27.119:8080. # NOTE: eth0 is using a static IP configuration. backend default { .host = "172.31.27.119"; .port = "8080"; } sub vcl_recv { # matches www.example.net AND example.net if (req.http.host == "(www.)example.net") { set req.backend_hint = default; } # matches www.example.org AND example.org if (req.http.host == "(www.)example.org") { set req.backend_hint = default; } # matches www.example.com AND example.com if (req.http.host == "(www.)example.com") { set req.backend_hint = default; } # matches www.example.org AND example.org OR # matches www.example.com AND example.com OR # matches www.example.net AND example.net if (req.http.host == "(www.)example.\borg|com|net\b") { set req.backend_hint = default; } # matches www.idlemind.net AND idlemind.net OR # matches www.idl3mind.net AND idl3mind.net if (req.http.host == "(www.)idl[e3]mind.net" ) { set req.backend_hint = default; } # matches www.helpwithdragon.com AND helpwithdragon.com OR # matches www.help-with-dragon.com AND help-with-dragon.com if (req.http.host == "(www.)help[\-]with[\-]dragon.com" ) { set req.backend_hint = default; } # matches www.badmojobrew.com AND badmojobrew.com OR # matches www.badmojobrewery.com AND badmojobrewery.com OR # matches www.badmojobrewing.com AND badmojobrewing.com OR # matches www.badmojobrewingco.com AND badmojobrewingco.com OR if (req.http.host == "(www.)badmojobrew\bery|ing|ingco\b.com" ) { set req.backend_hint = default; } }