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.
2 Answers
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);
}
}
X-Forwarded-For
header value to match your IP address.