I have a varnished 3.xx server that is currently running. Luck caches the login page of my site.
www.mysite.com/staff
but it may have different URLs depending on the link for employees, for example
www.mysite.com/staff/index.php?/Tickets/Ticket/View/222200
My varnish configuration file is set as follows to exclude caching of the page with the staff, but it does not work, because it caches the login page, and it does not log in until I restart the varnish to clear the cache.
sub vcl_recv { # Allow purge only from internal users if (req.request == "PURGE") { if (!client.ip ~ internal_net) { error 405 "Not allowed."; } return (lookup); # Exclude the following if (req.url ~ "^/login\.php" || req.url ~ "^/search\.php" || req.url ~ "^/admin(.*)" || req.url ~ "^/admin(.*)" || req.url ~ "^/search(.*)" || req.url ~ "^/visitor(.*)" || req.url ~ "^/staff(.*)" || req.url ~ "^/staff\.php" ) { return(pass); } if (req.http.cookie ~ "vb(.*)" || req.http.cookie ~ "bb(.*)" || req.http.cookie ~ "SWIFT_(.*)" || req.url ~ "\?(.*\&)?s=[a-fA-F0-9]{32}(\&|$)" || req.http.cookie ~ "bb_password") { return(pass); } else { unset req.http.cookie; } }
Perhaps you have another method for excluding and caching the entire directory? IE: everything from / staff, no matter what, the suffix after that should not be cached
source share