Varnish as an HTTP accelator for multiple Zope instances on multiple machines

Dag-Erling Smørgrav des at linpro.no
Wed Mar 14 10:15:46 CET 2007


Dirk Gomez <lists at dirkgomez.de> writes:
> sub vcl_recv {
>         if (req.request == "POST") {
>                 pipe;
>         }
>
>         # force lookup even when cookies are present
>         if (req.request == "GET" && req.http.cookie) {
>                 lookup;
>         }
>
>              if (req.http.host ~ "^hop.metatest.de") {
>                  set req.backend = thishost;
>              } elsif (req.http.host ~ "^zop.metatest.de") {
>                  set req.backend = thathost;
>              } else {
>                  error 404 "Unknown virtual host";
>              }
>
>
> }

You should select the backend *before* checking for POST or cookies.

> varnishlog gives me this output:
>
>    13 RxHeader     c Connection: keep-alive
>    13 RxHeader     c Host: zop.metatest.de
>    13 VCL_call     c recv
>    13 VCL_return   c lookup
>    13 VCL_call     c miss
>    13 VCL_return   c fetch
>    17 BackendClose   default
>    17 BackendOpen  b default 127.0.0.1 46677 127.0.0.1 7080
>
> So varnish goes to 127.0.0.1 instead of 192.168.100.199.

Most likely, the client sent a cookie.

DES
-- 
Dag-Erling Smørgrav
Senior Software Developer
Linpro AS - www.linpro.no



More information about the varnish-misc mailing list