cache-control
How to add Cache-Control header to static resource in Spring Boot?
This happens because of Spring Security: it rewrites all cache headers to disable caching totally. So we need to do two things: Disable spring security for static resources Enable static resource cache processing In current version of Spring Boot we can change this behavior in application.properties config. Disable spring security for some resources: # Comma-separated … Read more
Clear browser cache in Angular
When you are building the application using ng build, you should use the following flag: –outputHashing=all This is to enable cache-busting. This adds a hash to every single built file such that the browser is forced to load the latest version whenever you have uploaded a new version to your servers. Threfore, one way to … Read more
Cache-control: no-store, must-revalidate not sent to client browser in IIS7 + ASP.NET MVC
Through trial and error, I have found that one way to set the headers correctly for IIS7 in ASP.NET MVC is: Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.AppendCacheExtension(“no-store, must-revalidate”); Response.AppendHeader(“Pragma”, “no-cache”); Response.AppendHeader(“Expires”, “0”); The first line sets Cache-control to no-cache, and the second line adds the other attributes no-store, must-revalidate. This may not be the only way, but does provide … Read more
How to make Microsoft XmlHttpRequest honor cache control directive
Unfortunately the XMLHttpRequest object was designed this way, because it is based on WinInet. Also, it is not recommend to be used from the server side. You should use ServerXMLHttpRequest, which has the same functionality, but depends on WinHTTP instead. See the FAQ for more information. A description from the ServerXMLHttp documentation states that: The … Read more
What is difference between max-age and max-stale in cache control mechanism
From RFC 7234: The “max-age” request directive indicates that the client is unwilling to accept a response whose age is greater than the specified number of seconds. Unless the max-stale request directive is also present, the client is not willing to accept a stale response. … The “max-stale” request directive indicates that the client is … Read more
No expires header sent, content cached, how long until browser makes conditional GET request?
From the the HTTP caching spec (section 13.4): Unless specifically constrained by a cache-control (section 14.9) directive, a caching system MAY always store a successful response (see section 13.8) as a cache entry, MAY return it without validation if it is fresh, and MAY return it after successful validation. This means that a user agent … Read more
Can I force .htaccess to refresh?
If you’re using RewriteRule, just use R instead of R=301. For other purposes, you’ll have to clear your browser cache whenever you change a redirect. from https://stackoverflow.com/a/7749784/1066234
Max value for cache control header in HTTP
Generally one year is advised as a standard max value. See RFC 2616: To mark a response as “never expires,” an origin server sends an Expires date approximately one year from the time the response is sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one year in the future. Although that applies to … Read more