grav: Grav is inserting a "Pragma : no-cache" header which breaks mod_pagespeed

I’ve been trying to narrow down an issue I am having getting mod_pagespeed working. I seem to have narrowed it down to Grav but can’t find a way to stop this header.

I have a site at www.thinkoptimised.com which has mod_pagespeed running, however I don’t get the pagespeed header present on the response for the homepage. However I have also setup a http://www.thinkoptimised.com/example.html and http://www.thinkoptimised.com/example.php served from the same folder as the Grav index.php. For both the examples pages pagespeed is working correctly and the responses show the “X-Mod-Pagespeed : 1.11.33.2-0” header.

Trying to unset the header in the htaccess doesn’t solve the issue.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (13 by maintainers)

Most upvoted comments

That’s a moot issue (a performance killer).Pragma: no-cache basically bypasses any caching (from Apache to cloudflare) for every hit of every client on every page. If the goal is to use session for administration, then the admin-UI plugin should set a cookie (and nothing more) when needed, that means only after a successful login ¹. Pragma and Set-Cookie are showstoppers for high-traffic websites.

If a Set-Cookie is acceptable under some condition, a Pragma: no-cache is really not something a PHP application would usually use.

¹ Even better: use JS LocalStorage and fallback to cookies from client not supporting javascript.