Varnish doesnt PURGE urls
hamidreza hosseini
hrhosseini at hotmail.com
Mon Dec 9 10:44:27 UTC 2019
Hi,
I've two varnish, that one of them use ram as backend and another file as backend, requests first come to varnish(ram) and then go to another server in varnish(file) and then go to nginx, this is my diagram:
Req=====> [varnish ram] =======> [varnish file] =====> [Nginx]
And following file is my vcl configuration file that i'm using,
but when i want to purge a url it doesnt work and it steel remains in cache,
Should i chage my config file?
What's wrong with varnish?
Vcl config file:
### Naming note: use [0-9a-zA-Z_] only. no -. Or use camelCase ;-)
vcl 4.0;
import directors;
backend varnish_malloc_01 { .host = "192.168.200.12"; .port = "8080"; }
sub vcl_init {
new varnish_cluster = directors.round_robin();
varnish_cluster.add_backend(varnish_malloc_01);
}
acl purge {
"localhost";
"192.168.200.0"/24;
;
}
sub vcl_recv {
sub vcl_recv {
#set req.backend_hint = varnish_cluster.backend();
unset req.http.Cookie;
if (req.method == "PURGE") {
### TODO: also purge from the backend
if (!client.ip ~ purge) {
return(synth(405,"Not allowed."));
}
return (purge);
}
}
sub vcl_backend_response {
set beresp.ttl=48h;
# Don't cache 404 responses
if ( beresp.status == 404 ) {
set beresp.ttl = 120s;
set beresp.uncacheable = true;
return (deliver);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20191209/44be8e32/attachment-0001.html>
More information about the varnish-misc
mailing list