Following the accepted answer here on SO, I am trying to create a stylesheet that is editable with PHP.
What's happening...
I am trying to make the stylesheet (named css.php) cache in the user's browser so that he/she does not have to load it on every pageload, and have set the following headers to do so:
header('Content-Type: text/css;;charset=UTF-8');
header('cache-control: max-age=86400;');
header('Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT;');
header('Expires: Sat, 22 Nov 2014 16:00:00 GMT;');
header('cache-control: max-age=86400;');
These are the other headers sent by default:
Connection:"Keep-Alive"
Content-Encoding:"gzip"
Content-Length:"393"
Date:"Fri, 21 Nov 2014 17:00:50 GMT"
Keep-Alive:"timeout=5, max=99"
Server:"Apache"
Vary:"Accept-Encoding"
X-Frame-Options:"SAMEORIGIN"
However, upon loading a page that references the css.php page multiple times, it continues to reload the CSS page every time.
How do I know this...
I am receiving a hit to the css.php page every time I load the page which uses the stylesheet on my apache server access logs.
I can see that my Firefox browser is accessing the css.php page in the Inspect Element tool. It is receiving a HTTP 200 every time.
What should I do?
(from cache)which is displayed in size/content column in Chrome DevTools (no idea about firefox). Also keep in mind that most devtools disable that cache by default to you may need to untick thedisable cachecheckbox (in chrome this is at the top of the network panel)