Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Age: 0" HTTP Header

What is the HTTP header "Age" for? Specifically, what does a value of 0 (Age: "0") mean?

like image 961
shdev Avatar asked Oct 17 '10 16:10

shdev


People also ask

What is HTTP header age?

The Age header contains the time in seconds the object was in a proxy cache. The Age header is usually close to zero.

What is Max-age in HTTP header?

max-age. The max-age directive states the maximum amount of time in seconds that fetched responses are allowed to be used again (from the time when a request is made). For instance, max-age=90 indicates that an asset can be reused (remains in the browser cache) for the next 90 seconds.

What's the difference between Cache-Control max-age 0 and no-cache?

When max-age=0 is used, the browser will use the last version when viewing a resource on a back/forward press. If no-cache is used, the resource will be refetched.

What is no-cache header?

The no-cache directive means that a browser may cache a response, but must first submit a validation request to an origin server.


1 Answers

See the HTTP 1.1 specification on what the Age header field is intended to be used for:

The Age response-header field conveys the sender's estimate of the amount of time since the response (or its revalidation) was generated at the origin server.

This information is used by intermediate proxies to convey an estimate of how old a stored response is:

HTTP/1.1 requires origin servers to send a Date header, if possible, with every response, giving the time at which the response was generated (see section 14.18). We use the term "date_value" to denote the value of the Date header, in a form appropriate for arithmetic operations.

HTTP/1.1 uses the Age response-header to convey the estimated age of the response message when obtained from a cache. The Age field value is the cache's estimate of the amount of time since the response was generated or revalidated by the origin server.

Furthermore, the Age header field is intended to be used by intermediate caches only:

The presence of an Age header field in a response implies that a response is not first-hand.

That means the presence of the header field Age: 0 means that the received response was sent by an intermediate cache and is only zero seconds old. So it was probably just fetched from the origin server before sending it to the client.

like image 133
Gumbo Avatar answered Oct 14 '22 13:10

Gumbo