Varnish Dought

Shahid P.A shahid.azeez at gmail.com
Mon Jul 28 13:05:11 CEST 2008


Hai,

I configured varnish along with Apache as web server(2 web servers) and
Haproxy as load load balancer. Varnish is working when there is only one web
server.

The flow of rewuest is:

Fist the request hits Varnish  from varnish to Haproxy from here any one of
the web server (web1 or web2)

My varnish configuration is below

      backend default {
        # Our default backend, i.e. the web server
        # You can use more than 1. See docs.
        set backend.host = "0.0.0.0";
        set backend.port = "9999";
      }

         sub vcl_recv {
             if (req.request != "GET" && req.request != "HEAD") {
                 pipe;
             }
             if (req.http.Expect) {
                 pipe;
             }
             if (req.http.Authenticate || req.http.Cookie) {
                 pass;
             }
             if (req.request == "GET") {
                 lookup;
             }
             else {
                lookup;
             }
         }
        sub vcl_pipe {
             pipe;
         }

         sub vcl_pass {
             pass;
         }

         sub vcl_hash {
             set req.hash += req.url;
             set req.hash += req.http.host;
             hash;
         }

         sub vcl_hit {
             if (!obj.cacheable) {
                 pass;
             }
             deliver;
         }

         sub vcl_miss {
             fetch;
         }
         sub vcl_fetch {
             if (!obj.valid) {
                 error;
             }
             if (!obj.cacheable) {
                 pass;
             }
             insert;
         }

         sub vcl_deliver {
             deliver;
         }

         sub vcl_timeout {
             discard;
         }

         sub vcl_discard {
             discard;
         }


*Shahid*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20080728/3bb8b7bf/attachment-0001.html>


More information about the varnish-misc mailing list