Verifying the actual HTTP response headers Only the http-equiv values listed in HTML5 specification are allowed. Moreover, specifically those tags are invalid in HTML5. Generally, you'd better just not specify the HTML meta tags to avoid confusion by starters and rely on hard HTTP response headers. Take care with this when you don't specify them programmatically because the webserver can namely include some default values. The HTML meta tag will only be used when the page is viewed from a local disk file system via a file:// URL. Important to know is that when an HTML page is served over an HTTP connection, and a header is present in both the HTTP response headers and the HTML tags, then the one specified in the HTTP response header will get precedence over the HTML meta tag. Header set Cache-Control "no-cache, no-store, must-revalidate" (r/header "Cache-Control" "no-cache, no-store, must-revalidate") Using Clojure (require Ring utils): (require ') ResponseWriter.Header().Set("Expires", "0") // Proxies.
ResponseWriter.Header().Set("Pragma", "no-cache") // HTTP 1.0. Using Go: responseWriter.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") // HTTP 1.1. ('Cache-Control', 'no-cache, no-store, must-revalidate'), Using Python/Django: response = "no-cache, no-store, must-revalidate" # HTTP 1.1.
Response.headers = "no-cache" # HTTP 1.0. Response.headers = "no-cache, no-store, must-revalidate" # HTTP 1.1. Using Python/Flask: response = make_response(render_template(.)) Using Ruby on Rails: headers = "no-cache, no-store, must-revalidate" # HTTP 1.1. Response.addHeader "Expires", "0" ' Proxies. Response.addHeader "Pragma", "no-cache" ' HTTP 1.0. Using ASP: Response.addHeader "Cache-Control", "no-cache, no-store, must-revalidate" ' HTTP 1.1. Response.Headers = "no-cache, no-store, must-revalidate" Using ASP.NET: Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate") // HTTP 1.1. Response.Content?.Headers.TryAddWithoutValidation("Expires", 0.ToString()) since it allows only `DateTimeOffset?` values. Using ASP.NET Web API: // `response` is an instance of Response.AppendHeader("Expires", "0") // Proxies. Response.AppendHeader("Pragma", "no-cache") // HTTP 1.0. Using ASP.NET-MVC (HttpCacheability.NoCache) // HTTP 1.1. Using Java Servlet, or Node.js: tHeader("Cache-Control", "no-cache, no-store, must-revalidate") // HTTP 1.1. Using PHP: header("Cache-Control: no-cache, no-store, must-revalidate") // HTTP 1.1. The Last-Modified header as included in most other answers here is only interesting if you actually want to cache the request, so you don't need to specify it at all.
Other Cache-Control parameters such as max-age are irrelevant if the abovementioned Cache-Control parameters are specified.
#Txd tool for sa error no cache software#
the end-user manipulates the operating system date and the client software is relying on it. Date: Wed, 18:32:02 GMTÄ«ut that may fail if e.g. On the other hand, if the server auto-includes a valid Date header, then you could theoretically omit Cache-Control too and rely on Expires only. If you don't care about HTTP 1.0 proxies either, then you could omit Expires. If you don't care about IE6 nor HTTP 1.0 clients (HTTP 1.1 was introduced in 1997), then you could omit Pragma.
If you don't care about IE6 and its broken caching when serving pages over HTTPS with only no-store, then you could omit Cache-Control: no-cache. In HTTP 1.1, the Cache-Control takes precedence over Expires, so it's after all for HTTP 1.0 proxies only. The Expires is per the HTTP 1.0 and 1.1 specs for clients and proxies. The Pragma is per the HTTP 1.0 spec for prehistoric clients. The Cache-Control is per the HTTP 1.1 spec for clients and proxies (and implicitly required by some clients next to Expires). The correct minimum set of headers that works across all mentioned clients (and proxies): Cache-Control: no-cache, no-store, must-revalidate