Varnish cache and PHP session; setting header?

Posted by StCee on Server Fault See other posts from Server Fault or by StCee
Published on 2012-11-02T15:58:36Z Indexed on 2012/11/02 17:06 UTC
Read the original article Hit count: 189

Filed under:
|

Varnish by default would not cache page with cookies. I read on some posts that one workaround for PHP pages is to set

header('Cache-Control: public, s-maxage=60');

in php pages. But would it makes Varnish cache the page with the session cookie? Session is started on that page, and although there is nothing personal on that page, I would still want the session to persist in case the user would do something private later.

So is there a way to cache the page without the session cookie? And still be able to pass session between pages?

I can imagine some sort of weird solution with hidden form, but I would prefer if it can be done with VCL configuration or header setting. Thanks a lot!

© Server Fault or respective owner

Related posts about php

Related posts about varnish