Different TTLs dependent upon req.http.host?
    Peter Hinse 
    loco at d0pefish.de
       
    Wed Apr 29 18:20:44 CEST 2009
    
    
  
Hi all,
I have a varnish config looking roughly like this:
backend be1 {
  .host = "10.10.10.10";
  .port = "80";
}
sub vcl_recv {
    elseif (req.http.host ~ "^x.example.com") {
        set req.http.Host = "host.example.com";
        set req.backend = be1;
    }
    elseif (req.http.host ~ "^xi.example.com") {
        set req.http.Host = "host.example.com";
        set req.backend = be1;
    }
}
The backend server delivers dynamically rendered images I need to cache.
If the original requests comes in for Host x.example.com, the TTL can be
 12h, if the request is for xi.example.com, the TTL is 15m.
Since I cannot use "req.http.host" in vcl_fetch and the req.url look the
same, how can I distinguish the two cases and set the obj.ttl differently?
Regards,
	Peter
    
    
More information about the varnish-misc
mailing list