I'm running the configuration #1 I mentioned here:

http://lists.varnish-cache.org/pipermail/varnish-misc/2010-June/004342.html

Basically, varnishd listening on a bunch of ips, and then httpd listening on localhost:80 and all the sites as NameVirtualHosts. This seems to work well so far, but it has the disadvantage that if somebody goes to the raw ip addresses with their browser, they'll get the same site.

Can I use server.ip in vcl_recv to force the host to the right site if there's no host record? What would the code look like to do this? Something like:

if(!req.http.host) {
        if(server.ip == "a.b.c.d") {
                set req.http.host = "a.com";
        } elsif(server.ip == "a.b.c.e") {
...etc

Would that work?  Has anybody tried that?

Thanks,
Chris


_______________________________________________
varnish-misc mailing list
[email protected]
http://lists.varnish-cache.org/mailman/listinfo/varnish-misc

Reply via email to