Varnish String Concatenation in VCL

Oct 15 2010

For whatever reason, I have not seen Varnish documentation on concatenating strings. It's not on the official operators list. Even more bothersome, I occasionally see people using regular expression substitutions (regsuball) to do string concatenation in Varnish's VCL.

In fact, string concatenation in Varnish is simply a matter of setting a variable with two strings. For example, here's how to prefix a URL in vcl_recv:

set req.url = "/my_prefix" req.url

That's actually all there is to it. No explicit operator is needed. <!--break-->