Upgrading v3 -> v4; vcl check fails @ req.backend . What have I missed?

Dridi Boukelmoune dridi.boukelmoune at zenika.com
Sun May 4 18:22:12 CEST 2014


On Sun, May 4, 2014 at 6:04 PM,  <grantksupport at operamail.com> wrote:
> Hi,
>
> I've upgraded from Varnish 3 -> 4, and am working on converting my VCL,
> following
>
>         "Upgrading to Varnish 4"
>          https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html
>
> After making changes as I've understood them, I thing I've gotten most
> right, but on config file check, I still get a fail,
>
>         varnishd -C -f vcl.SITE.conf
>         Message from VCC-compiler:
>         Unknown variable 'req.backend'
>         At: ('input' Line 94 Pos 81)
>                         if     (req.url ~
>                         "\.(css|css?.*|woff|eot|svg|ttf|otf)$") { set
>                         req.backend = css_SITE1; }
>         --------------------------------------------------------------------------------###########-------------------------
>
>         Running VCC-compiler failed, exit 1
>
>         VCL compilation failed
>
>
> I've likely missed/misunderstood a required change :-/
>
> Here's the relevant snip from my config
>
>                 ...
>
>             backend def_SITE1 { .port = "10100"; include
>             "/usr/local/etc/varnish/backend_common.vcl"; }
>             backend css_SITE1 { .port = "10101"; include
>             "/usr/local/etc/varnish/backend_common.vcl"; }
>             backend  js_SITE1 { .port = "10102"; include
>             "/usr/local/etc/varnish/backend_common.vcl"; }
>             backend img_SITE1 { .port = "10103"; include
>             "/usr/local/etc/varnish/backend_common.vcl"; }
>
>             backend def_FALLBACK   { .port = "9999"; include
>             "/usr/local/etc/varnish/backend_common.vcl"; }
>
>         sub hostname_normalize {
>             if (req.http.host == "www.mydomain.net"  )              {
>             set req.http.host =   "mydomain.net"; }
>
>         sub backend_assign {
>             if (req.http.host == "mydomain.net" ) {
> 94              if     (req.url ~
> "\.(css|css?.*|woff|eot|svg|ttf|otf)$") { set req.backend = css_SITE1; }
>                 elseif (req.url ~ "\.(js|js?.*)$"
>                 ) { set req.backend =  js_SITE1; }
>                 elseif (req.url ~ "\.(jp(e?)g|gif|png|ti(f?)f)$"
>                 ) { set req.backend = img_SITE1; }
>                 else
>                  { set req.backend = def_SITE1; }
>             }
>
>         ...
>
> What's "req.backend" need to be changed to?

Hi,

You need to change it to backend_hint.

It is not clearly documented in the "upgrading" page but you can see
it on the directors examples.

Cheers,
Dridi

> Grant
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc



More information about the varnish-misc mailing list