'beresp.ttl': cannot be set in method 'vcl_hit' in Varnish 4.0

837 Views Asked by At

I am trying to import my old Varnish configuration to version 4.0.

sub vcl_hit {
     if (req.method == "PURGE") {
          set beresp.ttl = 0s;
          return (synth(200, "Purged."));
     }
}

Error I am getting:

Message from VCC-compiler:
'beresp.ttl': cannot be set in method 'vcl_hit'.
At: ('input' Line 135 Pos 15)
          set beresp.ttl = 0s;
--------------##########------

Running VCC-compiler failed, exited with 2

So how do I update that?

1

There are 1 best solutions below

4
On

Thats not working ;) there is a complete migrate guide how to migrate from 3 to 4

https://varnish-cache.org/docs/4.0/whats-new/upgrading.html

Here is a complete list what has changed and how you can fix it.