What does Cache-Control mean when a client uses it

2020-07-07 01:21发布

问题:

I thought I understood what the Http Header "Cache-Control: max-age=3600" meant but then I came across it in a client request as this:

Cache-Control: max-age=0

I'm not entirely sure what this means from a client's perspective.

Any insight would be great.

Thanks

回答1:

The answer is explained here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4

When used by user agents, its aim is to get intermediate caches to revalidate the response - so it's not for the server to deal with.

In server responses, max-age tells the client (and intermediate caches) how long to cache the response for.



回答2:

This means that the browser should NEVER cache the page, it should always retrieve a fresh copy of the page.