It seems there are multiple places to set cache headings. I’m trying to set up “cache everything” in Cloudflare, but the existing cache settings are overriding things.
So I’m trying to figure out where the current settings are coming from.
Currently (for the homepage only, intmath.com) I’m seeing
cache-control: max-age=0, must-revalidate, no-cache, no-store
content-type: text/html; charset=utf-8
date: Sat, 16 Nov 2019 02:32:23 GMT
expect-ct: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct”
expires: Fri, 15 Nov 2019 02:32:23 GMT
While I do have headers set on other pages in my site, I can’t find anywhere in my own scripts a header that sets the expires date to 24 hours ago for the home page.
In Pre VirtualHost Include in WHM, it suggests there should be a 5 minute expires time, but there isn’t:
ExpiresByType text/html “access plus 600 seconds”
I asked my hosting company to try to track down the setting, and they couldn’t find anything relevant. So my next guess is it’s a setting on Cloudflare.
For the home page only (until I get things sorted out), I’ve set a page rule “Cache everything” and “Origin cache control” to “on”. But the headers still appear as above, with a “one day ago” (and sometimes a 1981 date) expires setting.
This is the header I’m setting on the home page, which should give 1 hour in the future, but doesn’t:
header('Expires: '.gmdate(‘D, d M Y H:i:s \G\M\T’, time() + (60 * 60)));
On my local PC, I’m correctly seeing the expires directive as 1 hour after access, not some 1981 date:
- Connection: Keep-Alive
- Content-Length: 38
- Content-Type: text/html; charset=utf-8
- Date: Sun, 17 Nov 2019 08:45:25 GMT
- Expires: Sun, 17 Nov 2019 09:45:25 GMT
- Keep-Alive: timeout=5, max=100
- Server: Apache/2.4.39 (Win64) PHP/7.3.5
- X-Powered-By: PHP/7.3.5
If anyone can suggest if this might be a Cloudflare setting and where to change that caching directive, that will be a big help.