[Plugin: W3 Total Cache] Varnish purge is not working
-
Hi, I have just setup varnish on my server but it looks like W3 Total Cache was unable to clear the varnish cache!
Here is my varnish default.acl :
# This is a basic VCL configuration file for varnish. ?See the vcl(7) # man page for details on VCL syntax and semantics. # # Default backend definition. ?Set this to point to your content # server. # backend default { .host = "77.81.240.177"; .port = "8080"; } acl purge { "77.81.240.177"; } sub vcl_recv { # Add a unique header containing the client address remove req.http.X-Forwarded-For; #set ???req.http.X-Forwarded-For = client.ip; set req.http.X-Forwarded-For = req.http.rlnclientipaddr; # Let's make sure we aren't compressing already compressed formats. if (req.http.Accept-Encoding) { if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|mp3|mp4|m4v)(\?.*|)$") { remove req.http.Accept-Encoding; } elsif (req.http.Accept-Encoding ~ "gzip") { set req.http.Accept-Encoding = "gzip"; } elsif (req.http.Accept-Encoding ~ "deflate") { set req.http.Accept-Encoding = "deflate"; } else { remove req.http.Accept-Encoding; } } if (req.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return(lookup); } if (req.url ~ "^/$") { unset req.http.cookie; } } sub vcl_hit { if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { error 404 "Not in cache."; } if (!(req.url ~ "wp-(login|admin)")) { unset req.http.cookie; } if (req.url ~ "^/[^?]+.(jpeg|jpg|png|gif|ico|js|css|txt|gz|zip|lzma|bz2|tgz|tbz|html|htm)(\?.|)$") { unset req.http.cookie; set req.url = regsub(req.url, "\?.$", ""); } if (req.url ~ "^/$") { unset req.http.cookie; } } sub vcl_fetch { if (req.url ~ "^/$") { unset beresp.http.set-cookie; } if (!(req.url ~ "wp-(login|admin)")) { unset beresp.http.set-cookie; } if (req.url ~ "^/w00tw00t") { error 403 "Not permitted"; } }
I have set the ip 77.81.240.177 in the total cache settings as the varnish server. Please help me to fix this issue!
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘[Plugin: W3 Total Cache] Varnish purge is not working’ is closed to new replies.