background preloader

Cache

Facebook Twitter

HTTP/1.1: Header Field Definitions. This section defines the syntax and semantics of all standard HTTP/1.1 header fields.

HTTP/1.1: Header Field Definitions

For entity-header fields, both sender and recipient refer to either the client or the server, depending on who sends and who receives the entity. 14.1 Accept The Accept request-header field can be used to specify certain media types which are acceptable for the response. Accept headers can be used to indicate that the request is specifically limited to a small set of desired types, as in the case of a request for an in-line image. Accept = "Accept" ":" #( media-range [ accept-params ] ) media-range = ( "*/*" | ( type "/" "*" ) | ( type "/" subtype ) ) *( ";" parameter ) accept-params = ";" "q" "=" qvalue *( accept-extension ) accept-extension = ";" token [ "=" ( token | quoted-string ) ] The asterisk "*" character is used to group media types into ranges, with "*/*" indicating all media types and "type/*" indicating all subtypes of that type.

The example Accept: audio/*; q=0.2, audio/basic 1. 2. 3. 4. Caching Tutorial for Web Authors and Webmasters. For Web Authors and Webmasters This is an informational document.

Caching Tutorial for Web Authors and Webmasters

Although technical in nature, it attempts to make the concepts involved understandable and applicable in real-world situations. Because of this, some aspects of the material are simplified or omitted, for the sake of clarity. If you are interested in the minutia of the subject, please explore the References and Further Information at the end. What’s a Web Cache? A Web cache sits between one or more Web servers (also known as origin servers) and a client or many clients, and watches requests come by, saving copies of the responses — like HTML pages, images and files (collectively known as representations) — for itself. There are two main reasons that Web caches are used: To reduce latency — Because the request is satisfied from the cache (which is closer to the client) instead of the origin server, it takes less time for it to get the representation and display it.

Kinds of Web Caches Browser Caches Proxy Caches Gateway Caches. Speed Tips: Add Cache-Control Headers. Using Cache-Control headers you can specify which types of proxies can cache certain content, and how long files should be cached.

Speed Tips: Add Cache-Control Headers

You can also add the must-revalidate header to force checking the ETag and or Last-Modified for the file to make sure the cache is using the current version. Keep in mind, if you use a far future Expires header you have to change the component's filename whenever the file changes. So please add must-revalidate to your Cache-Control header for your .html files. This goes in your root .htaccess file but if you have access to httpd.conf that is better.

This code uses the FilesMatch directive and the Header directive to add Cache-Control Headers to certain files. # 480 weeks <FilesMatch "\. If you are using far Future Expires Headers and Cache-Control (recommended), you can do this for these files. <FilesMatch "\. Currently AskApache.com Uses ^ You can use the HTTP Header Viewer Tool to check it. Tags ^ March 10th, 2008 Comments Welcome ^