C5 with Varnish - unable to login
Permalink
Can anyone throw a suggestion my way for edits to my config. I am unable to login to any of my Cocnrete5 CMS sites. When I enter my credentials, the site defaults to the homepage as it should, however the admin bar at the top of the page is not present. I assume that the problem is with cookie handling. But, I really don't know. Anyone else run Varnish and be willing to help a fellow C5'er out?
Below is the relevant vcl_recv
else {set req.backend = default;}
# Do not cache these paths.
if (req.url ~ "^/login\.$" ||
req.url ~ "^/update\.php$" ||
req.url ~ "^/login/dashboard.*$" ||
req.url ~ "^/admin/build/features" ||
req.url ~ "^/info/.*$" ||
req.url ~ "^/config/.*$" ||
req.url ~ "^.*/ajax/.*$" ||
req.url ~ "^.*/ahah/.*$") {
return (pass);}
#Optimizations for Wordpress 10June11
#Stopped me from Logging In
#unset req.http.cookie;
#End
# Allow a grace period for offering "stale" data in case backend lags
set req.grace = 600m;
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
# Properly handle different encoding types
if (req.http.Accept-Encoding) {
if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf)$") {
# No point in compressing these
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 {
# unkown algorithm
remove req.http.Accept-Encoding;
}
}
# Force lookup if the request is a no-cache request from the client
# if (req.http.Cache-Control ~ "no-cache") {
# return (pass);
# }
## Default request checks
if (req.request != "GET" &&
req.request != "HEAD" &&
req.request != "PUT" &&
req.request != "POST" &&
req.request != "TRACE" &&
req.request != "OPTIONS" &&
req.request != "DELETE") {
# Non-RFC2616 or CONNECT which is weird.
return (pipe);
}
if (req.request != "GET" && req.request != "HEAD") {
# We only deal with GET and HEAD by default
return (pass);
}
## Modified from default to allow caching if cookies are set, but not http auth
if (req.http.Authorization) {
/* Not cacheable by default */
return (pass);
}
## Sites that I don't want to Cache 16June11
# if (req.http.host ~ "stats.nwlinux.com$") {return (pass);}
if (req.http.host ~ "nwlinux.co$") {return (pass);}
if (req.http.host ~ "warad.net$") {return (pass);}
if (req.http.host ~ "landtrain.net$") {return (pass);}
# if (req.http.host ~ "stats.nwlinux.com$") {return (pass);}
## Remove has_js and Google Analytics cookies.
# set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js)=[^;]*", "");
## Remove a ";" prefix, if present.
set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
## Remove empty cookies.
if (req.http.Cookie ~ "^\s*$") {
unset req.http.Cookie;
}
## Pass cron jobs
if (req.url ~ "cron.php") {
return (pass);
}
# Pass server-status
if (req.url ~ ".*/server-status$") {
return (pass);
}
# Don't cache install.php
if (req.url ~ "install.php") {
return (pass);
}
# Don't cache Piwik
if (req.url ~ "/config/.$") {
return (pass);
}
# Don't cache Concrete5 login
if (req.url ~ "login$") {return (pass);}
# Don't cache Concrete5 Dashboard
if (req.url ~ "dashboard/.$") {return (pass);}
# Cache things with these extensions
if (req.url ~ "\.(js|css|jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf)$") {
return (lookup);
}
# Don't cache Drupal logged-in user sessions
# LOGGED_IN is the cookie that earlier version of Pressflow sets
# VARNISH is the cookie which the varnish.module sets
if (req.http.Cookie ~ "(VARNISH|DRUPAL_UID|LOGGED_IN)") {
return (pass);
}
# Drop any cookies sent to Wordpress.
if (!(req.url ~ "wp-(login|admin)")) {unset req.http.cookie;}
#End Wordpress
# Drop any cookies sent to Concrete5.
if (!(req.url ~ "(login|admin)")) {unset req.http.cookie;}
#End Concrete5
}
Below is the relevant vcl_recv
else {set req.backend = default;}
# Do not cache these paths.
if (req.url ~ "^/login\.$" ||
req.url ~ "^/update\.php$" ||
req.url ~ "^/login/dashboard.*$" ||
req.url ~ "^/admin/build/features" ||
req.url ~ "^/info/.*$" ||
req.url ~ "^/config/.*$" ||
req.url ~ "^.*/ajax/.*$" ||
req.url ~ "^.*/ahah/.*$") {
return (pass);}
#Optimizations for Wordpress 10June11
#Stopped me from Logging In
#unset req.http.cookie;
#End
# Allow a grace period for offering "stale" data in case backend lags
set req.grace = 600m;
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
# Properly handle different encoding types
if (req.http.Accept-Encoding) {
if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf)$") {
# No point in compressing these
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 {
# unkown algorithm
remove req.http.Accept-Encoding;
}
}
# Force lookup if the request is a no-cache request from the client
# if (req.http.Cache-Control ~ "no-cache") {
# return (pass);
# }
## Default request checks
if (req.request != "GET" &&
req.request != "HEAD" &&
req.request != "PUT" &&
req.request != "POST" &&
req.request != "TRACE" &&
req.request != "OPTIONS" &&
req.request != "DELETE") {
# Non-RFC2616 or CONNECT which is weird.
return (pipe);
}
if (req.request != "GET" && req.request != "HEAD") {
# We only deal with GET and HEAD by default
return (pass);
}
## Modified from default to allow caching if cookies are set, but not http auth
if (req.http.Authorization) {
/* Not cacheable by default */
return (pass);
}
## Sites that I don't want to Cache 16June11
# if (req.http.host ~ "stats.nwlinux.com$") {return (pass);}
if (req.http.host ~ "nwlinux.co$") {return (pass);}
if (req.http.host ~ "warad.net$") {return (pass);}
if (req.http.host ~ "landtrain.net$") {return (pass);}
# if (req.http.host ~ "stats.nwlinux.com$") {return (pass);}
## Remove has_js and Google Analytics cookies.
# set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js)=[^;]*", "");
## Remove a ";" prefix, if present.
set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
## Remove empty cookies.
if (req.http.Cookie ~ "^\s*$") {
unset req.http.Cookie;
}
## Pass cron jobs
if (req.url ~ "cron.php") {
return (pass);
}
# Pass server-status
if (req.url ~ ".*/server-status$") {
return (pass);
}
# Don't cache install.php
if (req.url ~ "install.php") {
return (pass);
}
# Don't cache Piwik
if (req.url ~ "/config/.$") {
return (pass);
}
# Don't cache Concrete5 login
if (req.url ~ "login$") {return (pass);}
# Don't cache Concrete5 Dashboard
if (req.url ~ "dashboard/.$") {return (pass);}
# Cache things with these extensions
if (req.url ~ "\.(js|css|jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf)$") {
return (lookup);
}
# Don't cache Drupal logged-in user sessions
# LOGGED_IN is the cookie that earlier version of Pressflow sets
# VARNISH is the cookie which the varnish.module sets
if (req.http.Cookie ~ "(VARNISH|DRUPAL_UID|LOGGED_IN)") {
return (pass);
}
# Drop any cookies sent to Wordpress.
if (!(req.url ~ "wp-(login|admin)")) {unset req.http.cookie;}
#End Wordpress
# Drop any cookies sent to Concrete5.
if (!(req.url ~ "(login|admin)")) {unset req.http.cookie;}
#End Concrete5
}