Unable to login through varnish cache
Posted
by
ArunS
on Server Fault
See other posts from Server Fault
or by ArunS
Published on 2012-01-11T07:42:35Z
Indexed on
2012/10/04
9:40 UTC
Read the original article
Hit count: 284
I am setting up Active Collab Site in my new server. The setup is like below
Internet> ---> varnish ----> apache
But i am not able to login to the site through varnish cache.. But i can login to site through apache.
Here is my VCL file
backend default { .host = "localhost"; .port = "8080"; }
acl purge { "localhost"; }
sub vcl_recv { 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; }}
When i try to login through varnish i was redirect back to login page. If i enter wrong password, then it will ask for enter correct password.
© Server Fault or respective owner