Fwd: Newbie varnish configuration

Andrew Baudouin andrewmb at gmail.com
Mon Jun 25 16:18:50 CEST 2007


Hi,

I'd like to use Varnish as nothing more than a basic Internet security
appliance, that is set it up with a whitelist of sites and direct all other
domains to a local page which will ask for authentication, then forward
along if passed.  I'm trying to just get google.com and
wikipedia.orgworking as pass-through with the following  VCL... and
I'm having trouble.
Eventually I'd like to implement caching, but I'd like to just get the
simple stuff going for now.

Thanks for any insight you can provide.

----
    # This is a basic vcl.conf file for varnish.
     # Modifying this file should be where you store your modification to
     # varnish. Settnigs here will override defaults.

     backend default {
             set backend.host = "127.0.0.1";
             set backend.port = "80";
     }

    backend google {
        set backend.host = " www.google.com";
        set backend.port = "80";
    }

    backend wikipedia {
        set backend.host = "www.wikipedia.org ";
        set backend.port = "80";
    }

     sub vcl_recv {
             if (req.request == "POST") {
                     pipe;
             }

        if ( req.http.host ~ "^(www\.)?google\.com$") {
                 set req.backend = google;
            pass;
         }
        elseif (req.http.host ~ "^(www\.)?wikipedia\.org$") {
            set req.backend = wikipedia;
            pass;
        }
        elseif (req.http.host ~ "^(en\.)?wikipedia\.org$") {
            set req.backend = wikipedia;
            pass;
        }


             # force lookup even when cookies are present
             if (req.request == "GET" && req.http.cookie) {
                     lookup;
             }
     }

     sub vcl_fetch {
             # force minimum ttl of 180 seconds
             if (obj.ttl < 180s) {
                     set obj.ttl = 180s;
             }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20070625/c5b1328a/attachment-0001.html>


More information about the varnish-misc mailing list