Skip to main content
Share Your Experience: Take the 2024 Developer Survey
41 votes
Accepted

What happens if you don't set cache-control header?

If there is no Cache-Control header and no Expires header, but there is a Last-Modified header (which most web servers send by default for static assets), most browsers will use heuristic freshness to ...
Tim Fountain's user avatar
  • 4,464
17 votes
Accepted

Do ISPs cache HTTPS web pages?

If they provide an HTTP proxy service you use, they can cache on the fly. If they do not pervert the HTTPS stream (which starts by changing the server certificate exposed and/or changing the CAs you ...
Patrick Mevzek's user avatar
9 votes
Accepted

Prevent browser from caching text file

You have two approaches to this problem. The clean way is to set the headers returned for GET data.txt preventing the browser (or proxy) from storing the response in cache. Using apache, this can ...
Antony Gibbs's user avatar
7 votes

Headers to prevent 304/If-modified-since/HEAD requests

What you want is the immutable keyword in your Cache-Control line. Example for php: header('Cache-Control: public, max-age=80000, immutable'); Source: https://code.facebook.com/posts/557147474482256/...
Zdenek's user avatar
  • 256
7 votes

Do ISPs cache HTTPS web pages?

SSL/TLS is a transport encryption standard. It hides the entire communication between client and server. So decryption of the transport encryption* is a prerequisite to caching. Intercepting SSL/TLS ...
Peter Green's user avatar
6 votes

Why is Chrome caching my login page?

no-cache is not as strong as no-store. Chrome's documentation indicates that no-cache indicates a re-usable document, while no-store indicates that it should not be re-used. Based on this ...
Stephen Ostermiller's user avatar
6 votes
Accepted

Use A.jpg if you have it in cache, otherwise use B.jpg?

TL;DR answer: I don't think that exists in the way you mentioned similar to webp and, if it's possible, it would be with messy/unsupported workarounds. It may even trigger some ad blockers / antivirus....
Trich's user avatar
  • 601
5 votes
Accepted

Leverage Browser Caching for third party resources

As @TimFountain says, you have "no control" over resources served from a third party. The request goes to the third party server, not your server - so any code you place on your server is ...
MrWhite's user avatar
  • 42.8k
5 votes
Accepted

What headers used in request by google bot?

if ($_SERVER['HTTP_CACHE_CONTROL'] == 'no-cache') { Also bear in mind that the Cache-Control HTTP request header (as with most request headers) are entirely optional, so may not be present as part of ...
MrWhite's user avatar
  • 42.8k
5 votes
Accepted

Cache-Control for ads.txt, robots.txt and sitemap.xml files that are generated dynamically

I understand you want to use Cache-Control private/no-store because you don't want the CDN to cache an outdated version of those files. However, not caching these files (i.e. all requests go back to ...
iangetz's user avatar
  • 166
5 votes

Reliability of using query strings to refresh cache

This idea is called "cache busting", and there aren't any problems with your method that I'm aware of. It's a common, solid method that works reliably. The other common alternative, of ...
Maximillian Laumeister's user avatar
4 votes
Accepted

The Node Express server is returning "304 Not Modified" responses, but only after querying the database

The framework is: Generating the page internally for every request Using ETag headers with a content hash function to compare the generated page with the version sent before Either sending the full ...
Stephen Ostermiller's user avatar
4 votes
Accepted

Cloudflare: Cache static HTML when URL has Query String

(Answer added for @Festus Martingale to mark question as answered). Replacing the ? with a # solved the problem as it prevents the query string from being transmitted to cloudflare as it appears as a ...
Chris Rutherfurd's user avatar
4 votes
Accepted

Force visitors to get newest versions of resources (bypassing browser cache)

Sounds like your site is using HTTP caching which can be adjusted using some form of Leverage Browser Caching or using version strings on your files. Below you can 3 methods: Apache mod_expires, ...
Simon Hayter's user avatar
4 votes

Chrome doesn't remember vertical scroll position of my website when reloading the page?

In my case was a css issue at body (Firefox, Safari not affected by the problem): overflow: auto; After I remove it, it seems to work well.
Pedro's user avatar
  • 41
4 votes

404 While Trying To Clear URL From Google Amp Cache

You can generate the correct URL of your AMP page here: Get correct AMP URL here You enter your URL and you will get the AMP cache URL Then you must visit that URL The cache update will not be ...
Massimiliano Rubino's user avatar
4 votes

How to force users to see new site instead of the cached version?

You are likely out of luck. There is nothing you can do to uncache a client other then wait out the caching period. Delending on how bad the caching is, you may get some relief by using a different ...
davidgo's user avatar
  • 7,959
3 votes

"404. That’s an error." when viewing from Google cache

As I'm watching one of my sites closely, I noticed that the cache is now giving me a 404. I just bought a new domain name and the Google cache of that domain home page would return the old home page ...
Alexis Wilke's user avatar
  • 2,235
3 votes

Did I just stop my caching issue?

Yes, this will cause clients to re-download when the asset has expired a minute later. This runs under the assumption you've switched e-tags off (see below). The downside is people are now burning up ...
L Martin's user avatar
  • 4,003
3 votes
Accepted

Google no longer showing link to cached result in SERP result

Google hasn't discontinued the feature. The page you are looking at uses a meta tag to prevent caching: <meta name ="robots" content="noodp,noydir,all,noarchive" /> Specifically the ...
Stephen Ostermiller's user avatar
3 votes
Accepted

Reduce amount of site script executions

The host your using apparently has a limit on number of script executions you can do which is interesting to say the least; not the kind of host I would go with personally but personal opinions aside. ...
Jeff Wilbert's user avatar
3 votes

“Resources with a "?" in the URL are not cached by some proxy caching servers”

From http://bizcoder.com/caching-resources-with-query-strings: Steve demonstrates when using a version number in the query string, the Squid proxy cache does not cache the static file at all. He ...
Tim Fountain's user avatar
  • 4,464
3 votes

How to Fix Leverage browser caching connect.facebook.net/en_US/fbevents.js?

Unfortunately you can't directly remove the Insights warning. The PageSpeed tool can't tell that you don't own the facebook.net domain and therefore have no control over the response headers. ...
greg84's user avatar
  • 131
3 votes
Accepted

Deleted posts don't seem to be completely removed

As Google says on their support page: Google will remove the snippet and cached copy from search results. If the page is no longer available , it will remove the search result entirely. If the ...
garth's user avatar
  • 1,079
3 votes

JavaScript and CSS cached and not updating not updating from WAMP server even though "view source" shows most recent file

I was thinking that if it were just a caching problem, the old version of file should be show in "view source", shouldn't it? View Source will actually show you the new version of the file, not the ...
Maximillian Laumeister's user avatar
3 votes

Do browsers send different HTTP headers on page reload so that server side caches can be flushed?

No. The browser will send the same information on a refresh as if the user had just come to that page, with the same referrer information. Hence the problem of double-POSTing if someone refreshes the ...
GeoffAtkins's user avatar
  • 2,277
3 votes
Accepted

Do browsers send different HTTP headers on page reload so that server side caches can be flushed?

Browsers do send additional headers, but behavior different. This info in link a bit outdated: stackoverflow question Looks like Cache-control:no-cache is the best solution, to check for Ctrl+F5, but ...
LeonidMew's user avatar
  • 605
3 votes

How to force users to see new site instead of the cached version?

So that users don't see broken pages, you should make sure that your old images, css, js, etc get copied to your new server. That way, even if a user is viewing an old copy of the page, the browser ...
Stephen Ostermiller's user avatar
2 votes

Why is my website cached so aggressively?

If you're using chrome I like to switch to developer mode and then hold down the reload button next to the URL bar and it will present you with a few different options for reloading the page.
Max Coates's user avatar
2 votes

Is there any way to invalidate all memcache entries that begin with "User*"?

As memcached does not have namespace or something like delete/query by wildcards, you can do this trick: save all keys starts with namespace "user_" in a key. For example $keys = array('user_1', '...
Ha Doan Ngoc's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible