Varnish Setup with FC7

Hi All,
I’m struggling to get varnish to work for me. It’s up and running Ok, just not giving me the caching I’d like. I’ve added this.defaultProxyCacheTimeout = 120 into the farcryConstructor.cfc and also the decorators @@proxyCacheTimeout: 120 & @@cacheStatus: 1 into my webskin. But varnish won’t cache.
If I add the following into default.vlc :

if ( !( req.url ~"^/farcry/") ) {
unset req.http.Cookie;
}

I get caching big time, but then when logged in I get no bar at the bottom of my pages and a few other odd cache related oddities (like the login page not redirecting properly even though I’m logged in.)
Has anyone come up with some secret sauce vlc to get varnish to behave well with farcry?

Cheers Phil
`

You’ve just discovered one of the gotcha’s with reverse proxy caching:

  1. you can’t have cookies on a page and cache it at the same time, so;
  2. you don’t get session on cached pages

Depending on what version of core you’re using, you may have a cookie called FC-LOGGED-IN that you can look for in your Varnish config, and disable caching if the user is logged into FarCry. But if the public isn’t intended to log into the site then it would be better to have a separate domain for admins that bypasses Varnish.

Blair

We have a variety of helpful docs and sample VCLs available here:

https://farcry.jira.com/wiki/display/FCDEV60/Varnish+Web+Accelerator

Cheers :smile: Thats exactly what I’m after.