Different TTLs dependent upon req.http.host?
Peter Hinse
loco at d0pefish.de
Mon May 4 09:12:54 CEST 2009
Peter Hinse schrieb:
> 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?
No idea? User-defined variables do not work, is there any trick I can
use to handle requests to xi.example.com differently?
Regards,
Peter
More information about the varnish-misc
mailing list