regsub, string concatenation?

Jon Drukman jsd at cluttered.com
Fri Apr 18 18:35:42 CEST 2008


i'm trying to rewrite all incoming URLs to include the http host header 
as part of the destination url.  example:

incoming: http://site1.com/someurl
rewritten: http://originserver.com/site/site1.com/someurl

incoming: http://site2.com/otherurl
rewritten: http://originserver.com/site/site2.com/someurl

the originserver is parsing the original hostname out of the requested 
url.  works great with one hardcoded host:

set req.url = regsub(req.url, "^", "/site/site1.com");

i can't get it to use the submitted http host though...

  set req.url = regsub(req.url, "^", "/site/" + req.http.host);

varnish complains about the plus sign.  is there some way to do this 
kind of string concatenation in the replacement?

-jsd-




More information about the varnish-misc mailing list