Question about how browsers understand cache control and meta cache control tags
If i have something like this:
Cache-control: no-cache, no-store
and later i have
< meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate, max-age=0, s-maxage=0" />
Which cache control is applied to the page? Does it work in the same way in all the browsers?
Thanks
Related
We have a Wordpress based website that use <meta> to allow front-end retrieve the user's login status. However, it seems like not working properly on Firefox. Firefox keep caching the webpage even we have cache-control: no-cache, no-store, must-revalidate setup. I have tried few suggested solutions and none of them works on Firefox but works on Chrome and Safari. Here are the solutions I tried
# In the header of the page (Firefox just remove it from the page)
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="Sat, 26 Jul 1997 05:00:00 GMT" />
# From php
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
# Apache config
Header always set Cache-Control "no-cache, no-store, must-revalidate"
You can visit this page on different browsers and see the response headers in the Web dev tool. My result from:
Firefox and my result from Chrome.
Open to any suggestion, thanks much for help.
After the investigation, it's due to the Cloudflare. Not sure why it only effect Firefox, but after DevOps team modify the config on Cloudflare, the issue is fixed.
I'd like to speed up the initial loading of a site. It requests several API endpoints during inital render. I want to add <link rel="preload" /> for a few of these requests to make them start loading earlier. However these API responses are not cacheable by the browser. So the question is: How the browser behaves in such case? Will it fetch the content again regardless of the preload due to the no-cache headers or it's smart enough to relize that I need exactly that preloaded content?
So it turns out it's respecting no-cache headers as expected. I cannot preload such using <link rel="preload">. The solution is to add a few second TTL.
clicking on a element in a page, my application change the src attribute of an img element.
I don't understand why firefox gets the images with this http headers:
pragma no-cache Cache-Control: no-cache
avoiding firefox to use his own cache.
Chrome, for example, doesn't.
Thank you
Luca
Before answer I should add some detail:
1. My application is behind Tomcat
2. I saw that that headers was added only for file bigger than 512KB
Solution was to modify server.xml in order to have bigger cache object
<Context cacheMaxSize="40960" cacheObjectMaxSize="2148" docBase="\\mypath\docbase" path="/graphics" />
see:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Standard_Implementation
I have created a login page where my first line is if session->userdata() exist then redirect to home. But after login when I click the back button, I get back to the login page. I expected that my session check will work but it's not, any help?
i think this may help you.
add this in to your controller function to prevent caching of previous page
header("cache-Control: no-store, no-cache, must-revalidate");
header("cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
I'm trying to optimize my site using yslow and I scored an F for "Add Expires Headers" I currently have my index page set to no-cache for users logging in so my question is, is it possible to add a filematch for other file types like images, css, and js to my htaccess file?
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"/> <!-- Important for security -->
<META HTTP-EQUIV="Expires" CONTENT="-1"/>
If so will this impact or override my no-cache setting?
Thanks,
-Paul
Have a read of the section that starts "Never Expire" Policy in Chapter 3 of the Book of Speed - http://www.bookofspeed.com/chapter3.html