Questions tagged [http-caching]

Eliminate the need to send HTTP requests in many cases, and eliminate the need to send full HTTP responses in other cases, by storing web content closer to where it is consumed.

529 questions
10
votes
3 answers

Why SOAP can't use HTTP caching mechanisms

I am making a transition from SOAP to REST, and I would like to convince my colleagues that this is a good move. We don't need the extra security mechanisms that SOAP can provide. For us the overhead of SOAP and WSDL has only proven to be a headache…
Thijs Koerselman
  • 21,680
  • 22
  • 74
  • 108
9
votes
1 answer

Varnish + Static HTML Pages

I've recently come across a http web accelerator called Varnish. From what I've read, Varnish speeds up delivery of a website by optimizing every process of HTTP communication with the HTTP server using a reverse proxy configuration. My question is…
matsko
  • 21,895
  • 21
  • 102
  • 144
9
votes
3 answers

Why some css, js and images files are loaded from the disk cache and other no?

I'm running WP website with cache plugin enabled. The site is running slow so I decided to check which element is consuming more time to load. Straight to F12 (chrome web tools) and from there the tab Network. What I see and I don't understand is…
9
votes
1 answer

Odd Behaviour of Icon Caching

Consider this view that generates an ico image: from django.http import HttpResponse from app.somewhere import Favicon # View URL: `/.ico` def favicon( request, colour ): response = HttpResponse( Favicon.render( colour ), …
9
votes
1 answer

Service worker cache vs HTTP cache

I disabled service workers in couple of production websites, I can see resource load time is better when using HTTP cache (from disk cache & from memory cache) than with service workers (from serviceworker) when I debug using Chrome devtools…
tbnu
  • 126
  • 6
9
votes
2 answers

Retrofit: server returns both ETag and Cache-Control: max-age=60. Shouldn't the cache be used if request < 60s?

I am using Retrofit, configured to used OkHttp with a cache. I am calling this api: https://api.github.com/users/bod/repos which returns both an Etag and a Cache-Control: public, max-age=60, s-maxage=60 headers. I make two requests, in less than 60…
BoD
  • 10,838
  • 6
  • 63
  • 59
9
votes
2 answers

Explicitly disable caching for REST services

I am to apply Cache-Control: must-revalidate,no-cache,no-store to all responses from out backend REST services. I have two questions about it: Is it common to do so? For some reason I was under the impression that it's not necessary, but I have no…
wujek
  • 10,112
  • 12
  • 52
  • 88
9
votes
2 answers

How to avoid parsing when the server returns the same response using Retrofit?

I used to avoid parsing the server response over and over if it did not change by calculating the hash of the response: public class HttpClient { protected OkHttpClient mClient = new OkHttpClient(); public String get(final URL url, final…
JJD
  • 50,076
  • 60
  • 203
  • 339
9
votes
3 answers

Is Retrofit+Okhttp using httpCaching as a default in Android?

I use retrofit and okhttp in one of our applications. I can't really find a good explanation for the default behaviour of Retrofit. If Okhttp is on the class path it will be automatically used. But as far as I can see it the default…
Janusz
  • 187,060
  • 113
  • 301
  • 369
9
votes
1 answer

Etags and last-modified over https SSL?

Is it possible to use HTTP caching for conditional GET requests over a secure HTTPS connection? I've got caching working over non-secure HTTP, but when I switch to HTTPS the browser stops sending if-none-match and if-modified-since headers, so the…
Philip Brocoum
  • 2,866
  • 2
  • 24
  • 25
8
votes
2 answers

Is there an HttpClient that handles caching requests on its own?

I have an app that needs to make repeated requests for content on the web. Now the server side implementation follows the standards for http caching using the headers. I was wondering if there is an extended version of HttpClient or another tool…
Bobbake4
  • 24,509
  • 9
  • 59
  • 94
8
votes
1 answer

Should I add Cache-Control: no-cache to GET endpoints of my REST API?

When creating REST API working with POST/PUT is simple. They are non-idempotent and thus are NOT cached by browsers by default. However when creating a GET endpoint, things get tricker. I have this fear that browsers(or a particular one) by default…
Dimitry K
  • 2,236
  • 1
  • 28
  • 37
8
votes
1 answer

Why cache-control HTTP header for requests?

I recently went through this article. It says that not only response, the requests can also include cache-control options. Though I understood, it can be utilized by server responses meaningfully, I don't clearly understand why they are needed in…
Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87
8
votes
2 answers

Can a user agent set a max-age greater than zero in its request?

I have a doubt about max-age behaviour after reading the Http Cache rfc. Scenario: User agent GET /foo Origin Server Response header cache-control: max-age=120 Server tells user agent that the resource requested should be revalidated after 2…
systempuntoout
  • 71,966
  • 47
  • 171
  • 241
8
votes
1 answer

Caching of Access-Control-Allow-Origin value cross-site

I am trying to write an nginx config that will handle two sites on both http and https, it seems to work as long as a client never visits both sites, but if they do there are caching/cross-site issues. # Allow cross origin location ~*…
1 2
3
35 36