silikonvia.blogg.se

React http private cache
React http private cache




react http private cache

My ETag can be the SHA1 hash of a static resource (e.g. If I'm pulling a list of products out of a database, the server can send the last rowversion as an ETag, rather than a date: 200 OK What is ETag?ĮTag is similar to Last-Modified, except that it doesn't have to be a date - it just has to be a something. 1998) equivalent of the modern Cache-Control: max-age header:Īnd if both are specified, then the browser uses max-age: 200 OKĪny web-site written after 1998 should not use Expires anymore, and instead use max-age. The difference between "Cache-Control: max-age" and "Expires"Įxpires is a legacy (c. if you specified max-age, the browser won't even have to suffer the network round-trip the content will come right out of the caches.

react http private cache

  • if you specified only Last-Modified, the browser has to perform a If-Modified-Since request, and watch for a 304 Not Modified response.
  • The virtue of adding Cache-Control: max-age is that the browser doesn't even have to perform a "conditional" request. If it's a corporate proxy, then all 67,198 users hitting the same page in the same 15-second window will all get the same contents - all served from close cache. If the user hammers F5, they'll keep getting the cached version for 15 seconds. But I'm perfectly willing to let the user cache the homepage for 15 seconds: 200 OK If I'm building a page on the fly, there is no date associated with it - it's now. Not everything on the server has a date associated with it. Your browser did have to suffer the round-trip delay of sending a request to the server, and waiting for the response, but it did save having to re-download the static content. Rather than sending the client 200 OK, followed by the contents of the page, it instead tells you that your cached version is good: 304 Not Modified The server receives the request, realizes that the client has the most recent version already.

    react http private cache

    It will ask the server for the file, but instruct the server to only send the file if it has been modified since 6 3:13:38: GET / HTTP/1.1 they forgot to include E-Tag (so the browser can do a conditional request)īut they did include a Last-Modified date in the response: Last-Modified: Tue, 03:13:38 GMTīecause the browser knows the date the file was modified, it can perform a conditional request.they forgot to include Max-Age (so the browser knows how long the cached item is good for).they forgot to include Expires (so the browser knows to use the cached copy until that date).only on your own local machine):īut the server forgot to include any sort of caching hints: the item should only be cached in a private cache, i.e. The server kindly asked any intermediate proxies to not cache the contents (i.e. To answer your question about why caching is working, even though the web-server didn't include the headers:






    React http private cache