HighPerformanceWebSites

Css typetextcss import allows you to import one style

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Typical HTTP 1.1 response headers might look like this: –  Cache- Control is an alternaOve to Expires –  When cache-control: max-age is present, the response is stale if its current age is greater than the age value given (in seconds) at the Ome of a new request for the resource –  The max- age direcOve on a response implies that the response is cacheable HTTP/1.1 200 OK Date: Fri, 30 Oct 1998 13:19:41 GMT Server: Apache/1.3.3 (Unix) Cache-Control: max-age=3600, must-revalidate Expires: Fri, 30 Oct 1998 14:19:41 GMT Last-Modified: Mon, 29 Jun 1998 02:28:12 GMT ETag: "3e86-410-3596fbbc" Content-Length: 1040 Content-Type: text/html Here is a way to add an Expires header to files using the Apache httpd.conf file; add the lines: <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css| swf)$"> Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT" </FilesMatch> Copyright 2009 - 2013 Horowitz 15 Rule 4: Gzip Components •  Compression works when a web server like Apache is set up to "compress" resources and when a client’s browser accepts such compressed resources. •  During the iniOal negoOaOon, if both browser and server support at least one "common" compression method (gzip, compress, etc) then the transfer is compressed. • Client: GET / HTTP/1.1! Accept-Encoding: gzip,deflate • Server: HTTP/1.1 200 OK! Vary: Accept-Encoding! Content-Encoding: gzip! •  90% of browsers support compression ! Copyright 2009 - 2013 Horowitz 16 More on Gzip’ing Components •  A couple of Apache modules to enable / modify compression: •  Apache Module mod_deflate: –  hlp://hlpd.apache.org/docs/2.0/mod/mod_deflate.html –  Allows output from the server to be compressed before being sent to the client –  AddOutputFilterByType DEFLATE text/html text/plain text/xml •  Apache Module m...
View Full Document

Ask a homework question - tutors are online