vHosts (name or ip based) with varnish

Kristian Lyngstol kristian at varnish-software.com
Fri Jan 14 10:03:52 CET 2011


On Wed, Jan 12, 2011 at 04:18:16AM -0800, Jonathan Lopez wrote:
> In this mail I ask for a way to do this virtual host with something like
> this:
> 
> sub vcl_recv {
>         set req.http.Host = regsub(req.http.Host, "^www\.", ""); 
>         include "/etc/varnish/" req.http.host ".vcl";
> }

It's not possible and never will be. Sorry.

First of all, include can be considered as more of a pre-processor
directive. It's evaluated only on compile-time (just like with C
#include's).

What you are asking for _could_, theoretically, be done with a vmod, but I
doubt you'll see it any time soon. It opens for file-system access based on
client-input, which is an area you really do not want to get into.

- Kristian




More information about the varnish-misc mailing list