adding a double quote into a regsub in vcl_fetch

Stefan Caunter stef at scaleengine.com
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).*",
"<http://example.com/blah>; rel=\" + "canonical" + " ");
                return(deliver);
        }

which gets me

Link: <http://example.com/blah>; rel=canonical

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

Link: <http://example.com/blah>; 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 scaleengine.com
Skype: stefan.caunter
Toronto: +1 647 459 9475
+1 800 224 0192



More information about the varnish-misc mailing list