adding a double quote into a regsub in vcl_fetch

Stefan Caunter stef at
Tue Oct 15 21:57:59 CEST 2013

howdy (been a while)

in fetch i am trying to set a Link: header to normalize a bunch of
urls for the google

i put this

 if (req.url ~ "^/blah") {
                set beresp.http.Link = regsub(req.url, "^/(blah).*",
"<>; rel=\" + "canonical" + " ");

which gets me

Link: <>; rel=canonical

this is close to what the rfc wants, but what i need is

Link: <>; rel="canonical"

and i cannot get canonical in double quotes

vcl complains that the ')' is unterminated, and other such unpleasantness

does anyone know how to output the " character in a regsub?


Stefan Caunter
E: stef at
Skype: stefan.caunter
Toronto: +1 647 459 9475
+1 800 224 0192

More information about the varnish-misc mailing list