0

In varnish configuration file I put my public address inside acl. Still I can not purge varnish cache. It shows 403 error. I want to purge varnish remotely.I want to purge varnish only from my IP. Please help me how I can set the acl.

5
  • What is your complete VCL file? Do you use SSL termination (via Nginx)? Oct 3, 2016 at 11:00
  • I am not using ssl. I am using cloudflare. Is varnish getting the IP of cloudflare ?
    – linux404
    Oct 3, 2016 at 13:07
  • Yep. That explains it. You will need to update purge logic to check for X-Forwarded-For header value to match your IP address. Oct 3, 2016 at 14:30
  • How can I do it ?
    – linux404
    Oct 3, 2016 at 15:46
  • Check my answer. Tested with Varnish 4. Oct 3, 2016 at 21:08

2 Answers 2

0

You can look at this tutorial purging varnish cache remotely

1
 sub vcl_recv {
     if (req.method == "PURGE") {
         # If not allowed then a error 405 is returned
         if (! req.http.x-forwarded-for || req.http.x-forwarded-for !~ "1.2.3.4") {
            return(synth(405, "This forwarded IP is not allowed to send PURGE requests."));
        }
        return (purge);
    }
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .