1,441 questions
746
votes
9
answers
560k
views
What's the difference between Cache-Control: max-age=0 and no-cache?
The header Cache-Control: max-age=0 implies that the content is considered stale (and must be re-fetched) immediately, which is in effect the same thing as Cache-Control: no-cache.
242
votes
6
answers
204k
views
Difference between no-cache and must-revalidate for Cache-Control?
From the RFC 2616
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1
no-cache
If the no-cache directive does not specify a field-name, then a cache
MUST NOT use the response to ...
233
votes
5
answers
225k
views
What is the difference between HTTP status code 200 (cache) vs status code 304?
I'm using the Google "Page Speed" plug-in for Firefox to access my web site.
Some of the components on my page is indicated as HTTP status:
200
200 (cache)
304
By Google's "Page Speed".
What I'm ...
232
votes
7
answers
89k
views
what’s the difference between Expires and Cache-Control headers?
What’s the difference between Expires and Cache-Control headers?
181
votes
19
answers
9k
views
Cached, PHP generated Thumbnails load slowly
Question Part A ▉ (100 bountys, awarded)
Main question was how to make this site, load faster. First we needed to read these waterfalls. Thanks all for your suggestions on the waterfall readout ...
174
votes
4
answers
154k
views
What is Cache-Control: private?
When I visit chesseng.herokuapp.com I get a response header that looks like
Cache-Control:private
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/css
Date:Tue, 16 Oct 2012 06:37:53 GMT
...
159
votes
1
answer
74k
views
Private vs Public in Cache-Control
Can you please describe an example indicating difference between Public and Private Cache-Control in asp.net applications hosted in IIS.
I read in MSDN that the difference is the following:
Public:
...
158
votes
7
answers
346k
views
How to prevent browser caching of assets called from PHP pages?
Whenever I update CSS, JS, or image files the browser is loading the same old files stored in cache. How can I prevent this? I am serving my site pages with PHP.
150
votes
8
answers
165k
views
How to prevent Browser cache on Angular 2 site?
We're currently working on a new project with regular updates that's being used daily by one of our clients. This project is being developed using angular 2 and we're facing cache issues, that is our ...
142
votes
2
answers
6k
views
Is it fine if first response is private with AppCache (Symfony2)?
I'm trying to use http caching. In my controller I'm setting a response as follows:
$response->setPublic();
$response->setMaxAge(120);
$response->setSharedMaxAge(120);
$response->...
111
votes
10
answers
49k
views
Caching effect on CORS: No 'Access-Control-Allow-Origin' header is present on the requested resource
The short version of this issue is we are seeing the typical CORS error (x has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.) however we ...
109
votes
3
answers
79k
views
Max value for cache control header in HTTP
I'm using Amazon S3 to serve static assets for my website. I want to have browsers cache these assets for as long as possible. What meta-data headers should I include with my assets
Cache-Control: ...
95
votes
2
answers
57k
views
how does a etag work in expressjs
Expressjs automatically send etags. I would like to know how the etag is generated..is it based on the content that is generated dynamically by the get routine. or is there way I can mainpulate it, by ...
77
votes
3
answers
111k
views
HTTP Cache Control max-age, must-revalidate
I have a couple of queries related to Cache-Control.
If I specify Cache-Control max-age=3600, must-revalidate for a static html/js/images/css file, with Last Modified Header defined in HTTP header:
...
70
votes
8
answers
88k
views
Is Chrome ignoring Cache-Control: max-age?
Background:
IIS 7
AspNet 3.5 web app
Chrome dev tools lists 98 requests for the home page of the web app (aspx + js + css + images). In following requests, status code is 200 for css/images files. No ...
56
votes
3
answers
28k
views
Firebase hosting: How to prevent caching for the index.html of an SPA
I'm hosting an SPA on firebase where almost all paths get rewritten to index.html. I'm using webpack hash based cache busting, so I want to always prevent caching of my index.html but not any other ...
56
votes
6
answers
37k
views
Chrome browser is not sending if-modified-since header to server
I have these headers being sent to the client by the server:
Cache-Control:private
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/html
Date:Sun, 27 Nov 2011 11:10:38 GMT
ETag:"12341234"...
53
votes
2
answers
28k
views
Expires vs max-age, which one takes priority if both are declared in a HTTP response?
If a HTTP response that returns both Expires and max-age indications which one is used?
Cache-Control: max-age=3600
Expires: Tue, 15 May 2008 07:19:00 GMT
Considering that each one refers to a ...
51
votes
6
answers
50k
views
How long is a 302 redirect saved in browser?
Due to a misconfiguration of our webserver the main domain sent a 302 redirect to a new location. We fixed that issue. When emptying the browser cache everything works fine now.
For the "normal" ...
50
votes
10
answers
112k
views
how to force clearing cache in chrome when release new Vue app version
I created an app with vue-cli and then I build the dist folder for production.
The app is deployed on IIS with flask backend and works fine.
The problem occurs when I have to make some changes and I ...
45
votes
5
answers
36k
views
Why does Browser still sends request for cache-control public with max-age?
I have Amazon S3 objects, and for each object, I have set
Cache-Control: public, max-age=3600000
That is roughly 41 days.
And I have Amazon CloudFront Distribution set with Minimum TTL also with ...
44
votes
2
answers
41k
views
What is the risk of having HTTP header "Cache-Control: public"?
The Cache-Control HTTP/1.1 header can specify max-age as well as whether the cache content can be public or private, indicating whether intermediate cache can cache the content.
For example, Ruby on ...
44
votes
2
answers
31k
views
Cache-Control headers repeated; valid or not? (Nginx)
I've got a resource in my Nginx that is configured like this:
location ~ foo\.js$ {
add_header Cache-Control public;
expires 1d;
}
If I open this with Firebug and look at the headers it shows ...
43
votes
2
answers
51k
views
Make IE cache the resources but always revalidate
The cache control header "no-cache, must-revalidate, private" allows browsers to cache the resource but forces a revalidate with conditional requests. This works as expected in FF, Safari, and Chrome.
...
42
votes
9
answers
35k
views
Add Cache-Control and Expires headers to Azure Storage Blobs
I'm using Azure Storage to serve up static file blobs but I'd like to add a Cache-Control and Expires header to the files/blobs when served up to reduce bandwidth costs.
Application like CloudXplorer ...
37
votes
3
answers
20k
views
No expires header sent, content cached, how long until browser makes conditional GET request?
Assume browser default settings, and content is sent without expires headers.
user visits website, browser caches images etc.
user does not close browser, or refresh page.
user continues to surf ...
36
votes
4
answers
88k
views
Can I force .htaccess to refresh?
We are moving a site from one CMS to another. The .htaccess file has been changed and it needs to be refreshed for the new site to work right. From what I understand the .htaccess file will only be ...
35
votes
1
answer
13k
views
What is difference between max-age and max-stale in cache control mechanism
I know this is a simple question, and I am sure that no body will mark this as duplicate question, because I have searched all over the SO. so my question is what is the difference between max-age and ...
34
votes
4
answers
129k
views
Clear browser cache in Angular
I have a problem with an Angular application that I update very often.
I would like to avoid the browser cache and I am trying several alternatives but none of them work.
The first thing is that I ...
34
votes
10
answers
31k
views
How to make Microsoft XmlHttpRequest honor cache control directive
i'm issuing a request using MSXML's XmlHttpRequest object:
IXMLHttpRequest http = new XmlHttpRequest();
http.open("GET", "http://www.bankofcanada.ca/stat/fx-xml.xml", False, "", "");
http.send();
And ...
33
votes
3
answers
61k
views
Cache-control: no-store, must-revalidate not sent to client browser in IIS7 + ASP.NET MVC
I am trying to make sure that a certain page is never cached, and never shown when the user clicks the back button. This very highly rated answer (currently 1068 upvotes) says to use:
Response....
32
votes
8
answers
60k
views
How to add Cache-Control header to static resource in Spring Boot?
How can I add Cache-Control HTTP header in Spring Boot for static resources?
Tried using a filter-component in the application, which writes headers correctly, but Cache-Control header gets ...
30
votes
4
answers
96k
views
Add an Expires or a Cache-Control header in JSP
How do you add an Expires or a Cache-Control header in JSP? I want to add a far-future expiration date in an include page for my static components such as images, CSS and JavaScript files.
29
votes
4
answers
45k
views
How to set Cache-Control Header in amazon cloudfront?
I have a amazon cloudfront distribution that creates a 'origin' to my CDN. In my behavior, I set the Max TTL, Min TTL and default TTL. But my response header does't return the Cache-control header in ...
28
votes
2
answers
12k
views
Chrome is sending Cache-control:no-cache header
We have configured nginx server to add cache control header to public and expiration time to 1 month.
But when we make a request from browser, client is adding Cache-Control: no-cache header. Because ...
28
votes
2
answers
6k
views
Why Chrome Dev Tool shows a 200 status code instead of 304
While I was testing a weird behaviour in cache handling with Chrome (I asked something about it here), I found something else: Chrome dev tool shows a 200 status code when the server returns a 304 ...
24
votes
4
answers
68k
views
HTML - Cache control max age
I'ld like to present always the latest website content to the user but also have it fast loaded. By researching I came across postings people suggesting to use the cache for speeding up loading.
So ...
24
votes
6
answers
21k
views
How to disable caching for i18next translation.json files?
I'm running a single page app on IIS and using i18next library for translations in my app. The problem is that sometimes when I add new keywords to my translation.json file and hit refresh, the ...
24
votes
2
answers
7k
views
Which browsers support "Cache-control: immutable"?
I've read that Firefox has begun supporting a cache control extension value of immutable, which means that "the response body will not change over time." So even if a user requests a "...
24
votes
2
answers
17k
views
Flask static file Cache-Control
I'm trying to set a reasonable cache expiry for my JS files while in development. I have the standard setup, where HTML, CSS and JS are living under the static directory.
The docs do mention this, ...
23
votes
3
answers
20k
views
Preventing cache on back-button in Safari 5
As of recent safari 5 was released, and it turns out to cause some problems for my website. I have a dynamic website running classic ASP (though that shouldn't matter much) and the site has some ...
22
votes
2
answers
26k
views
Is it possible to set headers conditionally?
I would like .htaccess to perform the following code ONLY if http_referer is from google (.com/ .ru/ .co.uk /.co.in/ etc.). Is this possible?
<filesMatch ".(jpg|jpeg|png|gif)$">
...
22
votes
4
answers
70k
views
Force cache refresh after deployment
Is there a way to force a client's cache to reload an HTML file if you can't change the URI referencing that file (e.g., can't add a timestamp param)?
Here's my situation:
A plugin deployed to a 1000 ...
21
votes
2
answers
24k
views
Any reason not to add "Cache-Control: no-transform" header to every page?
We have recently fixed a nagging error on our website similar to the one described in How to stop javascript injection from vodafone proxy? - basically, the Vodafone mobile network was vandalizing our ...
20
votes
6
answers
35k
views
Why browser does not send "If-None-Match" header?
I'm trying to download (and hopefully cache) a dynamically loaded image in PHP. Here are the headers sent and received:
Request:
GET /url:resource/Pomegranate/resources/images/logo.png HTTP/1.1
Host:...
20
votes
2
answers
23k
views
Get Asp.net/iis to set Cache-control:max-age for static files
We have a Webforms project with url routing. I have defined exception routes for images and css-files as
routes.Add("IgnoreImages", new Route("img/{*pathInfo}", new StopRoutingHandler()));
routes.Add(...
20
votes
1
answer
25k
views
Retrofit - Okhttp client How to cache the response
I'm trying to cache the response of http calls done by Retrofit(v 1.9.0) with OkHttp(2.3.0). It always made the network calls if I try to make a call without internet then java.net....
19
votes
2
answers
17k
views
How to add headers in nginx only sometimes
I have a nginx proxy to a API server. The API sometimes sets the cache control header. If the API hasnt set the cache control I want nginx to override it.
How do I do that?
I think I want to do ...
19
votes
5
answers
38k
views
Most Efficient Way Of Clearing Cache Using ASP.NET
I am building an ASP.NET/Umbraco powered website which is very custom data driven via entity framework, we are having to cache quite a lot of the data queries (For example searches by keyword) as it'...
18
votes
3
answers
29k
views
What does `expires -1` mean in NGINX `location` directive?
Given the sample location example below, what does -1 mean for expires? Does that mean "never expires" or "never caches"?
# cache.appcache, your document html and data
location ~* \...