Varnish doesnt PURGE urls

Guillaume Quintard guillaume at varnish-software.com
Mon Dec 9 19:48:42 UTC 2019


Hi,

How do you tell that it's not purging?

Cheers,

-- 
Guillaume Quintard


On Mon, Dec 9, 2019 at 2:45 AM hamidreza hosseini <hrhosseini at hotmail.com>
wrote:

> 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);
>     }
> }
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20191209/fbb8f1c0/attachment.html>


More information about the varnish-misc mailing list