Specifying life time for a webpage

Firosh Ummer
By Firosh Ummer

October 15, 2008

We have often come across the message "Webpage has expired" when attempting to access a recently accessed page. This message comes as a result of the web server specifying an expiration time for the webpage when it is stored on the browser's cache. How does a web server specify the life time for a page to the browser's cache?

  1. Using the Expires header
  2. Using the Max-age directive along with Expires header
  3. Setting the Must-Revalidate header in the response
  4. All of the above

The answer is d. All of the above.

The content stored in the cache can be set to have a defined expiry time or can be set to be validated with the web server before it is served.

By using the Expires header value in the HTTP response header the web-server can ensure that this content will become stale at this time. eg.Expires: Fri, 30 Oct 1998 14:19:41 GMT. Instead of using an absolute time in Expires - we can also mention a relative time by using max-age. Max age=3600 means this content will be stored for the next 3600 seconds or one hour.

By setting the "must-revalidate" in the HTTP response header the server can ensure that the cache [private or shared] will always revalidate before serving the contents irrespective of the Expiry and max-age.

Our tutorial on HTTP Essentials explains how the life time of a page can be managed.

Tags: Quiz


Firosh Ummer