Page 1 of 1

Browser cache control does not work

Posted: Thu Sep 24, 2015 11:57 am
by faglork
Hi everybody!

I am on Apache / PHP 5.6 / CMSMS 1.12

I need to set the cache control max-age to 60 Minutes.

But regardless of the cmsms browser cache setting, the header contains
Cache-Control: public, max-age=10800

.htaccess settings don't apply either:
ExpiresByType text/html "access plus 1 hour"
does not work (filesmatch does't work either).

The only way to change the max-age is turning the "browser cache" setting OFF, which is not desirable:
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

The "Expires" directive follows the setting in cmsms, but unfortunately "Cache-Control" overrides "Expires" ...

Any ideas how to change that?

Cheers,
Alex

Re: Browser cache control does not work

Posted: Tue Sep 29, 2015 9:45 pm
by faglork
"The Lounge" ???

Why has it been moved?


Cheers,
Alex

Re: Browser cache control does not work

Posted: Sat Oct 03, 2015 7:36 pm
by faglork
As far as I understand (please correct me if I am wrong):

- this refers to cmsms version 1.12 -

in index.php, line: 71:

Code: Select all

require_once($dirname.'/include.php');
in include.php, beginning with line 36, the cache headers are set.

Code: Select all

#Setup session with different id and start it
if( isset($CMS_ADMIN_PAGE) || isset($CMS_INSTALL_PAGE) )
  {
       (settings for admin pages)
  }
else {
    @session_cache_limiter('public');
}
However, according to
http://php.net/manual/en/function.sessi ... .php#82174
this sets the cache parameters to

Expires: pageload + 3 hours
Cache-Control: public, max-age=10800


Later on, from line 154 downward, in index.php, the "expires" parameter gets set according to the setting in 'Browser Cache Expiry Period'.
Line 168:

Code: Select all

header('Expires: '.gmdate("D, d M Y H:i:s",time() + $expiry * 60).' GMT');
Now, we have the correct "expires" setting, but "Cache-Control" still is "public, max-age=10800" (see above).

"Cache-Control" overrides "Expires", so the cache setting is always three hours ("10800").

Can someone confirm this? Or do I misinterpret the code?

And: how can I change that without modifying the core?

Cheers,
Alex