Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
> curl --head http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
HTTP/1.1 200 OK
Last-Modified: Thu, 19 Feb 2009 22:38:52 GMT
Content-Type: application/x-javascript; charset=UTF-8
Expires: Fri, 27 Aug 2010 18:40:36 GMT
Date: Thu, 27 Aug 2009 18:40:36 GMT
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
Cache-Control: public, max-age=31536000
Age: 7435
Server: GFE/2.0
Transfer-Encoding: chunked

It says expires 27 Aug 2010. Hower the cache-control says max-age = 315360000 (far far in future). Does it mean browser will cache this data for a long time? Or based on expires value it will request another copy immediately?

share|improve this question
add comment

3 Answers

My understanding is that the Expires header is the old method of doing it, and Cache-Control is the modern way of doing it, which allows more granularity for dealing with proxy servers, etc.

In either case, version 1.3.2 of the file will always be version 1.3.2, so they both are saying to cache it for a long, long time.

share|improve this answer
add comment

The value you pasted from curl for max-age was 31536000, or 1 year. So both headers are saying the same thing: consider the content fresh for one year.

share|improve this answer
add comment

If there is a conflict between Cache-Control and Expires, the browser should listen to Cache-Control,

This means that Cache-Control overrides Expires (This is written in HTTP/1.1 docs)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.