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 fronted)] =======> [varnish file (varnish 
backend)] =====> [Nginx]

And following file is my vcl configuration file that i'm using,
when i  purge a url there is  no problem with frontend but it doesnt purge from 
backend
I run varnishlog on both servers and i determines diffrences in link below:
https://www.diffchecker.com/NRPsTEGO
(Note that my problem is with varnish backend it doesnt purge the url, one of 
the wierd things is that logs show that the url purged successfully and 
returned 200 ok , but that url doesnt remove from cach )
How can i solve my problem?

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);
    }
}

 Best regards

_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to