0
if (req.url ~ "do_ajax.php" && req.request == "GET") {
      return (lookup);
}

I put this line inside the varnish.vcl config, but I get this header in the response header:

no-cache, must-revalidate, max-age=0

I also tried with:

if (req.url ~ "do_ajax.php" && req.request == "GET") {
      return (hash);
}

But varnish fails to restart unless I remove return (hash).

Now, I am wondering if there's a line in the varnish config file that forces all ajax calls to not accept cache, and the second thing I don't understand is why I am getting it in the response header, shouldn't it be the client that sends this in the request header instead? Why is the server returning this?

Sayaman
  • 187
  • 1
  • 11

1 Answers1

0

As mentioned in one of the other posts you made: you are probably using an outdated version of Varnish. That may explain why the VCL syntax is not working.

Please make sure you're on Varnish 6 or Varnish 7. See https://www.varnish-software.com/developers/downloads/#linux-packages for a list of install procedures depending on the Linux distribution you are using.

I also provided a VCL solution in one of the other posts you made.

Thijs Feryn
  • 1,166
  • 4
  • 5