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?
Using the Expires header
Using the Max-age directive along with Expires header
Setting the Must-Revalidate header in the response
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.