Okay, I'm trying this and it works. I realized I don't have any NameVirtualHost sites going through varnish right now, so I just stomp the req.http.Host with the correct site name at the top, and that let me remove all the www. stripping from the vcl_recv. I did notice that Host: is set by browsers even on numerical ips (due to HTTP/1.1 I guess), so I think the right if is something like:

if(!req.http.host ||
   (req.http.host ~ "^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$"))
{
        blah;
}

but I haven't tried that yet, since I realized I don't need it yet. Does that look right?

Chris


On 2010/07/12 00:46, Poul-Henning Kamp wrote:
In message<[email protected]>, Chris Hecker writes:

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

Yes, that is server.ip was intended to be used.

If that does not work, it is a bug.


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

Reply via email to