C5.8.1 and Varnish (how to have C5 return the correct Cache-control headers) SOLVED

Permalink
Hi.
I am trying to use varnish 5.0 to cache a number of C5 websites. The varnish config is setup and working. The problem I have is that the website content is not being cached. Digging into the issue it would seem that C5 is outputting a Cache-Cointrol: No-cache in the returned header which varnish is then respecting by not caching the pages. In C5 I have all of the a caching switched on in C5, I have added a cache control directive in the page header-top.php to use caching but all I get is no-cache. I am at a loss on how to proceed with this, I am told that varnish can cache C5 and I am working with a co-worker to change the varnish config to ignore the c5 cache control but how do I get C5 to return correct headers to allow caching?

Thanks
Martyn

FaganSystems
 
FaganSystems replied on at Permalink Best Answer Reply
FaganSystems
In case anyone else hits this issue, this is what I have found to Solve the issue.
This morning I decided to dig deeper and found that in fact it isn't C5 that's determining the Cache Control headers by in fact its the php config.
I changed the value of session_cache_limiter in php.ini see herehttp://php.net/manual/en/function.session-cache-limiter.php... from nocache to public and then set the correct session.cache_expire to the number of minutes I wanted caching to occur.
I can now remove the draconian directive in Varnish to cache everything and ignore the cache control headers.

I hope this helps out others

FaganSystems