Trying to use X-Backend to select backend

Bernardf FRIT bernard at frit.net
Thu Oct 29 13:49:33 CET 2009


Hi,

I'm mostly a newby.

I downgraded varnish to v 2.0.3 in order to use the 
varnish-bereq-hosts.patch

I want to :

   1. Store the backend name into X-Backend custom header
   2. Force each request with  a X-Backend header to be directed to the
      stored backend name

My .vcl file :

sub vcl_recv {
.../...
if (req.http.host ~ "^(www.)?mysite.com$") {
    if (req.http.X-Backend) {
        set req.backend = req.http.X-Backend ;
    } else {
        set req.backend = www_director;
    }
}
../..
sub vcl_fetch {.
../..
    set obj.http.X-Backend = bereq.backend;
../..

And I got the following error :
Message from VCC-compiler:
Expected ID got 'req.http.X-Backend'
(program line 233), at
(input Line 54 Pos 27)
        set req.backend = req.http.X-Backend ;
--------------------------##################--

I don't know how to transfer X-Backend value into req.backend.

Can you help me please ?

Best regards.
--
Bernard FRIT

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20091029/68b354d0/attachment-0002.html>


More information about the varnish-misc mailing list