Mailing List Archive

ttl problem
> Hi, (Sorry, my english is bad)
> this is my VCL conf, what is wronk? Varnish didnt starting.
>
> backend default {
> set backend.host = "xxx.xxx.xxx.xxx";
> set backend.port = "xxxx"; set obj.ttl = 2d;
> }
> sub vcl_recv {
> if (req.request == "GET" && req.url ~
> "\.(gif|jpg|swf|css|js|html|htm)$") {
> set obj.ttl = 12h;
> lookup;
> }
> }
> sub vcl_recv {
> if (req.http.host ~ "^(www.)?xxx.ttd/xxxxxx/.*$") {
> pass;
> }
> }
> sub vcl_recv {
> if (req.http.host ~ "^(www.)?xxx.ttd/xxxx/xxxxxxx/.*$") {
> pass;
> }
> }
> sub vcl_recv {
> if (req.http.host ~ "^(www.)?xxx.ttd/xxxx/.*$") {
> set obj.ttl = 1h;
> }
> }
>
> If I disable all [set obj.ttl = xx;] ,varnish start OK.
>
ttl problem [ In reply to ]
In message <4847F27E.7060709 at xlevyv.cz>, Vojtech Levy writes:

>> sub vcl_recv {
>> if (req.http.host ~ "^(www.)?xxx.ttd/xxxx/.*$") {
>> set obj.ttl = 1h;
>> }
>> }
>>
>> If I disable all [set obj.ttl = xx;] ,varnish start OK.

You cannot set the ttl in vcl_recv{}, the object has not been
found or fetched yet.

You probably want to do that in vcl_fetch{} instead.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.